diff --git a/examples/tabwidgetexamples/mainwindow.cpp b/examples/tabwidgetexamples/mainwindow.cpp index bca363ee..53a0ac4c 100644 --- a/examples/tabwidgetexamples/mainwindow.cpp +++ b/examples/tabwidgetexamples/mainwindow.cpp @@ -45,6 +45,12 @@ MainWindow::MainWindow(QWidget* parent) : tab->setIconStyle(QQtPictureEffectTabBar::IconStyle_Cover_And_RightText); tab->setTabPixmap(0, "./skin/default/bt_setting.png", "./skin/default/bt_setting_press.png"); tab->setTabPixmap(1, "./skin/default/bt_user.png", "./skin/default/bt_user_press.png"); + + ui->tw1->setStyleSheet("QTabWidget#tw1 QTabBar::tab { width:90px; height:30px; }"); + QQtPictureEffectTabBar* tab1 = (QQtPictureEffectTabBar*)ui->tw1->localTabBar(); + tab1->setIconStyle(QQtPictureEffectTabBar::IconStyle_Cover_And_RightText); + tab1->setTabPixmap(0, "./skin/default/bt_setting.png", "./skin/default/bt_setting_press.png"); + tab1->setTabPixmap(1, "./skin/default/bt_user.png", "./skin/default/bt_user_press.png"); } MainWindow::~MainWindow() diff --git a/examples/tabwidgetexamples/mainwindow.ui b/examples/tabwidgetexamples/mainwindow.ui index 8d19cbf9..8e81839b 100644 --- a/examples/tabwidgetexamples/mainwindow.ui +++ b/examples/tabwidgetexamples/mainwindow.ui @@ -18,7 +18,7 @@ - 0 + 2 @@ -141,6 +141,22 @@ Tab 1 + + + + + + Tab 1 + + + + + Tab 2 + + + + + diff --git a/src/exquisite/qqtcustomeffectprogressbar.h b/src/exquisite/qqtcustomeffectprogressbar.h index f43b53b9..05e815b7 100644 --- a/src/exquisite/qqtcustomeffectprogressbar.h +++ b/src/exquisite/qqtcustomeffectprogressbar.h @@ -280,8 +280,8 @@ private: // QWidget interface protected: - virtual void mouseReleaseEvent(QMouseEvent* event) Q_DECL_OVERRIDE; - virtual void mouseDoubleClickEvent(QMouseEvent* event) Q_DECL_OVERRIDE; + virtual void mouseReleaseEvent(QMouseEvent* event) override; + virtual void mouseDoubleClickEvent(QMouseEvent* event) override; }; #endif //QQTCUSTOMEFFECTPROGRESSBAR_H diff --git a/src/exquisite/qqthorizontaltexteffecttabbar.cpp b/src/exquisite/qqthorizontaltexteffecttabbar.cpp index 6ca2b627..4a8b5589 100644 --- a/src/exquisite/qqthorizontaltexteffecttabbar.cpp +++ b/src/exquisite/qqthorizontaltexteffecttabbar.cpp @@ -105,20 +105,6 @@ void QQtHorizontalTextEffectTabBar::paintEvent(QPaintEvent* e) setShape(QTabBar::RoundedWest); } - // Only draw the tear indicator if necessary. Most of the time we don't need too. - if (0 && cutLeft >= 0) - { - cutTabLeft.rect = rect(); - cutTabLeft.rect = style()->subElementRect(QStyle::SE_TabBarTearIndicatorLeft, &cutTabLeft, this); - p.drawPrimitive(QStyle::PE_IndicatorTabTearLeft, cutTabLeft); - } - - if (0 && cutRight >= 0) - { - cutTabRight.rect = rect(); - cutTabRight.rect = style()->subElementRect(QStyle::SE_TabBarTearIndicatorRight, &cutTabRight, this); - p.drawPrimitive(QStyle::PE_IndicatorTabTearRight, cutTabRight); - } } void QQtHorizontalTextEffectTabBar::drawTextLabel(QPainter* p) diff --git a/src/exquisite/qqthorizontaltexteffecttabbar.h b/src/exquisite/qqthorizontaltexteffecttabbar.h index f682c657..a61fb42c 100644 --- a/src/exquisite/qqthorizontaltexteffecttabbar.h +++ b/src/exquisite/qqthorizontaltexteffecttabbar.h @@ -27,37 +27,37 @@ public slots: private: static void initStyleBaseOption(QStyleOptionTabBarBase* optTabBase, QTabBar* tabbar, QSize size) { - QStyleOptionTab tabOverlap; - tabOverlap.shape = tabbar->shape(); - int overlap = tabbar->style()->pixelMetric(QStyle::PM_TabBarBaseOverlap, &tabOverlap, tabbar); - QWidget* theParent = tabbar->parentWidget(); - optTabBase->init(tabbar); - optTabBase->shape = tabbar->shape(); - optTabBase->documentMode = tabbar->documentMode(); - if (theParent && overlap > 0) - { - QRect rect; - switch (tabOverlap.shape) - { - case QTabBar::RoundedNorth: - case QTabBar::TriangularNorth: - rect.setRect(0, size.height() - overlap, size.width(), overlap); - break; - case QTabBar::RoundedSouth: - case QTabBar::TriangularSouth: - rect.setRect(0, 0, size.width(), overlap); - break; - case QTabBar::RoundedEast: - case QTabBar::TriangularEast: - rect.setRect(0, 0, overlap, size.height()); - break; - case QTabBar::RoundedWest: - case QTabBar::TriangularWest: - rect.setRect(size.width() - overlap, 0, overlap, size.height()); - break; - } - optTabBase->rect = rect; - } +// QStyleOptionTab tabOverlap; +// tabOverlap.shape = tabbar->shape(); +// int overlap = tabbar->style()->pixelMetric(QStyle::PM_TabBarBaseOverlap, &tabOverlap, tabbar); +// QWidget* theParent = tabbar->parentWidget(); +// optTabBase->init(tabbar); +// optTabBase->shape = tabbar->shape(); +// optTabBase->documentMode = tabbar->documentMode(); +// if (theParent && overlap > 0) +// { +// QRect rect; +// switch (tabOverlap.shape) +// { +// case QTabBar::RoundedNorth: +// case QTabBar::TriangularNorth: +// rect.setRect(0, size.height() - overlap, size.width(), overlap); +// break; +// case QTabBar::RoundedSouth: +// case QTabBar::TriangularSouth: +// rect.setRect(0, 0, size.width(), overlap); +// break; +// case QTabBar::RoundedEast: +// case QTabBar::TriangularEast: +// rect.setRect(0, 0, overlap, size.height()); +// break; +// case QTabBar::RoundedWest: +// case QTabBar::TriangularWest: +// rect.setRect(size.width() - overlap, 0, overlap, size.height()); +// break; +// } +// optTabBase->rect = rect; +// } } }; diff --git a/src/exquisite/qqthorizontaltexteffecttabwidget.h b/src/exquisite/qqthorizontaltexteffecttabwidget.h index ec242532..bee984d4 100644 --- a/src/exquisite/qqthorizontaltexteffecttabwidget.h +++ b/src/exquisite/qqthorizontaltexteffecttabwidget.h @@ -19,8 +19,8 @@ private: // QQtTabWidget interface public: - virtual void setObjectName(const QString& name) Q_DECL_OVERRIDE; - virtual QQtTabBar* localTabBar() const Q_DECL_OVERRIDE { return m_bar; } + virtual void setObjectName(const QString& name) override; + virtual QQtTabBar* localTabBar() const override { return m_bar; } }; #endif // QQTHORIZONTALTEXTEFFECTTABWIDGET_H diff --git a/src/exquisite/qqtpictureeffecttabbar.cpp b/src/exquisite/qqtpictureeffecttabbar.cpp index 4ff14bdb..f912f2e2 100644 --- a/src/exquisite/qqtpictureeffecttabbar.cpp +++ b/src/exquisite/qqtpictureeffecttabbar.cpp @@ -144,6 +144,16 @@ void QQtPictureEffectTabBar::drawText(QPainter* p) QRect tabTextRect = tabRect(index); //-rect.height()/20 上移 verticalTabs() ? tabTextRect.adjust(0, 0, 0, 0) : tabTextRect.adjust(0, 0, 0, 0); + if (iconStyle == IconStyle_Cover_And_BottomText) + tabTextRect.adjust(0, 0, 0, -2); + else if (iconStyle == IconStyle_Cover_And_TopText) + tabTextRect.adjust(0, +2, 0, 0); + else if (iconStyle == IconStyle_Cover_And_LeftText) + tabTextRect.adjust(+2, 0, 0, 0); + else if (iconStyle == IconStyle_Cover_And_RightText) + tabTextRect.adjust(0, 0, -2, 0); + else if (iconStyle == IconStyle_Cover_And_MiddleText) + tabTextRect.adjust(0, 0, 0, 0); if (iconStyle == IconStyle_Left_And_RightText) tabTextRect = QRect(tabTextRect.left() + tabTextRect.height(), tabTextRect.top(), @@ -158,6 +168,8 @@ void QQtPictureEffectTabBar::drawText(QPainter* p) flags = Qt::AlignVCenter | Qt::AlignLeft; else if (iconStyle == IconStyle_Cover_And_RightText) flags = Qt::AlignVCenter | Qt::AlignRight; + else if (iconStyle == IconStyle_Cover_And_MiddleText) + flags = Qt::AlignVCenter | Qt::AlignHCenter; //pline() << objectName() << rect; //if on board text is normal, this is right. otherwise the palette is right diff --git a/src/exquisite/qqtpictureeffecttabbar.h b/src/exquisite/qqtpictureeffecttabbar.h index 4911d37f..506efa17 100644 --- a/src/exquisite/qqtpictureeffecttabbar.h +++ b/src/exquisite/qqtpictureeffecttabbar.h @@ -23,6 +23,7 @@ public: IconStyle_Cover_And_BottomText, IconStyle_Cover_And_LeftText, IconStyle_Cover_And_RightText, + IconStyle_Cover_And_MiddleText, //color style IconStyle_Left_And_RightText, IconStyle_Max_Style diff --git a/src/exquisite/qqtpictureeffecttabwidget.h b/src/exquisite/qqtpictureeffecttabwidget.h index d27a5fcd..bc04ee8b 100644 --- a/src/exquisite/qqtpictureeffecttabwidget.h +++ b/src/exquisite/qqtpictureeffecttabwidget.h @@ -19,8 +19,8 @@ private: // QQtTabWidget interface public: - virtual void setObjectName(const QString& name) Q_DECL_OVERRIDE; - virtual QQtTabBar* localTabBar() const Q_DECL_OVERRIDE { return m_bar; } + virtual void setObjectName(const QString& name) override; + virtual QQtTabBar* localTabBar() const override { return m_bar; } }; #endif // QQTPICTUREEFFECTTABWIDGET_H diff --git a/src/exquisite/qqtslideeffecttabbar.h b/src/exquisite/qqtslideeffecttabbar.h index df18ef17..17dc74cd 100644 --- a/src/exquisite/qqtslideeffecttabbar.h +++ b/src/exquisite/qqtslideeffecttabbar.h @@ -54,15 +54,15 @@ private: // QWidget interface protected: - virtual void paintEvent(QPaintEvent* event) Q_DECL_OVERRIDE; + virtual void paintEvent(QPaintEvent* event) override; // QWidget interface protected: - virtual void mousePressEvent(QMouseEvent* event) Q_DECL_OVERRIDE; + virtual void mousePressEvent(QMouseEvent* event) override; // QWidget interface protected: - virtual void mouseReleaseEvent(QMouseEvent* event) Q_DECL_OVERRIDE; + virtual void mouseReleaseEvent(QMouseEvent* event) override; }; #endif // QQTSLIDEEFFECTTABBAR_H diff --git a/src/exquisite/qqtslideeffecttabwidget.h b/src/exquisite/qqtslideeffecttabwidget.h index d9a894f2..905f198c 100644 --- a/src/exquisite/qqtslideeffecttabwidget.h +++ b/src/exquisite/qqtslideeffecttabwidget.h @@ -19,8 +19,8 @@ private: // QQtTabWidget interface public: - virtual void setObjectName(const QString& name) Q_DECL_OVERRIDE; - virtual QQtTabBar* localTabBar() const Q_DECL_OVERRIDE { return m_bar; } + virtual void setObjectName(const QString& name) override; + virtual QQtTabBar* localTabBar() const override { return m_bar; } }; #endif // QQTSLIDEEFFECTTABWIDGET_H diff --git a/src/gui/qqtsqltreemodel.h b/src/gui/qqtsqltreemodel.h index 25a9b835..988ef878 100644 --- a/src/gui/qqtsqltreemodel.h +++ b/src/gui/qqtsqltreemodel.h @@ -16,8 +16,8 @@ public: // QQTVirtualTreeModel interface public: - bool query(QString condition) Q_DECL_OVERRIDE; - void setFilePath(QString dbname) Q_DECL_OVERRIDE; + bool query(QString condition) override; + void setFilePath(QString dbname) override; protected: bool parseDatabase(); diff --git a/src/gui/qqtxmltreemodel.h b/src/gui/qqtxmltreemodel.h index eb2436d7..c4ef3c8d 100644 --- a/src/gui/qqtxmltreemodel.h +++ b/src/gui/qqtxmltreemodel.h @@ -18,8 +18,8 @@ public slots: // QQTTreeModel interface public: - bool query(QString condition) Q_DECL_OVERRIDE; - void setFilePath(QString xmlfile) Q_DECL_OVERRIDE; + bool query(QString condition) override; + void setFilePath(QString xmlfile) override; protected: /** diff --git a/src/network/qqtserver.h b/src/network/qqtserver.h index 881b4623..9f66f694 100644 --- a/src/network/qqtserver.h +++ b/src/network/qqtserver.h @@ -21,7 +21,7 @@ public: signals: // QTcpServer interface protected: - virtual void incomingConnection(qintptr handle) Q_DECL_OVERRIDE; + virtual void incomingConnection(qintptr handle) override; private: QQtProtocol* m_protocol; }; diff --git a/src/qqt_header.pri b/src/qqt_header.pri index c4e383cd..fb9ce07a 100644 --- a/src/qqt_header.pri +++ b/src/qqt_header.pri @@ -115,7 +115,7 @@ contains (DEFINES, __CPP11__) { #compile period #LibQQt need c++11 support. Please ensure your compiler version. - #LibQQt used Q_DECL_OVERRIDE identifier + #LibQQt used override identifier #lambda also need c++11 } diff --git a/src/widgets/qqtlabel.h b/src/widgets/qqtlabel.h index a7b8b655..4e2eda4b 100644 --- a/src/widgets/qqtlabel.h +++ b/src/widgets/qqtlabel.h @@ -17,11 +17,11 @@ public slots: // QWidget interface protected: - virtual void mouseReleaseEvent(QMouseEvent* event) Q_DECL_OVERRIDE; + virtual void mouseReleaseEvent(QMouseEvent* event) override; // QWidget interface protected: - virtual void mouseDoubleClickEvent(QMouseEvent* event) Q_DECL_OVERRIDE; + virtual void mouseDoubleClickEvent(QMouseEvent* event) override; }; #endif // QQTLABEL_H diff --git a/src/widgets/qqtwidget.h b/src/widgets/qqtwidget.h index 47615f84..e655e745 100644 --- a/src/widgets/qqtwidget.h +++ b/src/widgets/qqtwidget.h @@ -40,12 +40,12 @@ private: quint32 m_style; // QWidget interface protected: - void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE; + void paintEvent(QPaintEvent*) override; // QWidget interface protected: - virtual void mouseReleaseEvent(QMouseEvent* event) Q_DECL_OVERRIDE; - virtual void mouseDoubleClickEvent(QMouseEvent* event) Q_DECL_OVERRIDE; + virtual void mouseReleaseEvent(QMouseEvent* event) override; + virtual void mouseDoubleClickEvent(QMouseEvent* event) override; }; #endif // QPICWIDGET_H