mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-22 03:45:51 +08:00
refactor ui
- Implemented CustomTab class with notification support and custom painting. - Created CustomTabWidget to manage multiple tabs with a stacked widget layout. - Integrated glider animation for smooth tab transitions. - Updated DeviceInfoWidget to improve layout and visual appearance with shadows. - Refactored DeviceMenuWidget to use QStackedWidget instead of QTabWidget for better flexibility. - Enhanced main window setup with custom tab widget and improved device management UI. - Added macOS specific window styling for a more native look. - Improved ToolboxWidget layout and styling for better user experience.
This commit is contained in:
+3
-12
@@ -10,8 +10,8 @@
|
||||
BatteryWidget::BatteryWidget(float value, bool isCharging, QWidget *parent)
|
||||
: QWidget(parent), m_value(value), m_isCharging(isCharging)
|
||||
{
|
||||
setMinimumSize(50, 40);
|
||||
setMaximumSize(60, 40);
|
||||
setMinimumSize(30, 30);
|
||||
setMaximumSize(40, 40);
|
||||
}
|
||||
|
||||
void BatteryWidget::resizeEvent(QResizeEvent *)
|
||||
@@ -111,7 +111,7 @@ void BatteryWidget::paintEvent(QPaintEvent *)
|
||||
pen.setColor(Qt::white);
|
||||
painter.setPen(pen);
|
||||
QFont textFont = QFont();
|
||||
textFont.setPixelSize(widgetFrame.height() / 2);
|
||||
textFont.setPixelSize(widgetFrame.height() / 1.65);
|
||||
painter.setFont(textFont);
|
||||
QFontMetrics fm(textFont);
|
||||
QString percentageLevelString = QString("%1%").arg(m_value);
|
||||
@@ -121,13 +121,4 @@ void BatteryWidget::paintEvent(QPaintEvent *)
|
||||
QPointF textPosition = QPointF(widgetFrame.center().x() - textWidth / 2,
|
||||
widgetFrame.center().y() + textHeight / 3);
|
||||
painter.drawText(textPosition, percentageLevelString);
|
||||
|
||||
float chargerSize = widgetFrame.height() / 2;
|
||||
|
||||
// if (isCharging) {
|
||||
// QPixmap pixmap(":/img/charge.png");
|
||||
// painter.drawPixmap(widgetFrame.center().x() - chargerSize * 1.5,
|
||||
// widgetFrame.top() + chargerSize / 2, chargerSize,
|
||||
// chargerSize, pixmap);
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user