mirror of
https://gitee.com/drabel/LibQQt.git
synced 2025-01-04 10:18:44 +08:00
submit base qqttabbar qqttabwidget and add qqtslideeddecttab qqtpictureeddecttab widget
This commit is contained in:
parent
75187a9ee5
commit
fec570fe32
24
QQt.pro
24
QQt.pro
@ -2,20 +2,20 @@ TEMPLATE = subdirs
|
||||
CONFIG += ordered
|
||||
|
||||
SUBDIRS = src/qqt.pro
|
||||
SUBDIRS += examples/framelesshelperwidget
|
||||
SUBDIRS += examples/qqtframe
|
||||
SUBDIRS += examples/qqtframe2
|
||||
SUBDIRS += examples/animationframe
|
||||
SUBDIRS += examples/cmdwidget
|
||||
SUBDIRS += examples/qqtnetworkexample
|
||||
#open SUBDIRS += examples/framelesshelperwidget
|
||||
#open SUBDIRS += examples/qqtframe
|
||||
#open SUBDIRS += examples/qqtframe2
|
||||
#open SUBDIRS += examples/animationframe
|
||||
#open SUBDIRS += examples/cmdwidget
|
||||
#open SUBDIRS += examples/qqtnetworkexample
|
||||
SUBDIRS += examples/exquisite
|
||||
SUBDIRS += examples/QtBuildTool
|
||||
SUBDIRS += examples/QtSdkManager
|
||||
SUBDIRS += examples/QQtInstaller
|
||||
#open SUBDIRS += examples/QtBuildTool
|
||||
#open SUBDIRS += examples/QtSdkManager
|
||||
#open SUBDIRS += examples/QQtInstaller
|
||||
|
||||
#need QQt installed to Qt library or
|
||||
#need QQt installed to sdk
|
||||
SUBDIRS += examples/qqtframe3
|
||||
#open SUBDIRS += examples/qqtframe3
|
||||
#SUBDIRS += examples/VegeTablesPrice
|
||||
|
||||
#need vlcQt libvlc library
|
||||
@ -28,8 +28,8 @@ SUBDIRS += examples/qqtframe3
|
||||
#SUBDIRS += examples/qqtbluetoothfiletransferserver
|
||||
|
||||
#need QtSoap - WebSupport
|
||||
SUBDIRS += examples/easter
|
||||
SUBDIRS += examples/soapQQtOnline
|
||||
#open SUBDIRS += examples/easter
|
||||
#open SUBDIRS += examples/soapQQtOnline
|
||||
|
||||
#need webkitwidgets - WebSupport
|
||||
#webkit webengine
|
||||
|
@ -56,6 +56,12 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
equals(QKIT_PRIVATE, macOS) {
|
||||
QMAKE_PRE_LINK += echo hello
|
||||
QMAKE_PRE_LINK += rm -rf bin/exquisite.app
|
||||
}
|
||||
|
||||
system(touch main.cpp)
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <QMouseEvent>
|
||||
#include <QKeyEvent>
|
||||
#include <qqtcore.h>
|
||||
#include <qqtslideeffecttabbar.h>
|
||||
|
||||
MainWindow::MainWindow(QWidget* parent) :
|
||||
QMainWindow(parent),
|
||||
@ -158,8 +159,40 @@ MainWindow::MainWindow(QWidget* parent) :
|
||||
connect(m_timer, SIGNAL(timeout()), this, SLOT(setValue()));
|
||||
|
||||
m_timer_down->start(10);
|
||||
|
||||
/*
|
||||
ui->w60->setFixedHeight(30);
|
||||
QQtSlideEffectTabBar* bar = new QQtSlideEffectTabBar(ui->tab_6);
|
||||
QQtSlideEffectTabBar* bar2 = new QQtSlideEffectTabBar(ui->tab_6);
|
||||
bar->addTab("xxx");
|
||||
bar->addTab("ccc");
|
||||
bar2->setShape(QQtSlideEffectTabBar::RoundedEast);
|
||||
bar2->addTab("yyy");
|
||||
bar2->addTab("ddd");
|
||||
|
||||
QSpacerItem* space = new QSpacerItem(800, 30, QSizePolicy::Maximum);
|
||||
QGridLayout* lay = new QGridLayout(ui->tab_6);
|
||||
lay->addWidget(ui->w60, 1, 1, 1, 2);
|
||||
lay->addWidget(bar, 2, 1, 1, 2);
|
||||
lay->addWidget(bar2, 3, 1, 1, 1);
|
||||
lay->addItem(space, 3, 2, 1, 1);
|
||||
|
||||
ui->tab_6->setLayout(lay);
|
||||
*/
|
||||
/*
|
||||
QQtSlideEffectTabBar* bar2 = new QQtSlideEffectTabBar(ui->tab_6);
|
||||
ui->tb1->setTabBar(bar2);
|
||||
*/
|
||||
//QQtSlideEffectTabBar* bar = new QQtSlideEffectTabBar(ui->tb0);
|
||||
//ui->tb0->setTabBar(bar);
|
||||
//ui->tb0->setObjectName("tb0");
|
||||
|
||||
ui->w77->addTab("ddd");
|
||||
ui->w77->addTab("xxxx");
|
||||
ui->w77->setFixedHeight(28);
|
||||
}
|
||||
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
|
@ -18,7 +18,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
@ -109,6 +109,11 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_11">
|
||||
<attribute name="title">
|
||||
<string>页</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_6">
|
||||
<attribute name="title">
|
||||
<string>页</string>
|
||||
@ -116,10 +121,63 @@
|
||||
<widget class="QQTProgressBar" name="w60" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<x>180</x>
|
||||
<y>20</y>
|
||||
<width>491</width>
|
||||
<height>41</height>
|
||||
<width>571</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QQtSlideEffectTabWidget" name="tb0">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>170</y>
|
||||
<width>311</width>
|
||||
<height>241</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="tabPosition">
|
||||
<enum>QTabWidget::West</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_7">
|
||||
<attribute name="title">
|
||||
<string>Tab 1</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_8">
|
||||
<attribute name="title">
|
||||
<string>Tab 2</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QTabWidget" name="tb1">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>480</x>
|
||||
<y>160</y>
|
||||
<width>391</width>
|
||||
<height>241</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_9">
|
||||
<attribute name="title">
|
||||
<string>Tab 1</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_10">
|
||||
<attribute name="title">
|
||||
<string>Tab 2</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QQtSlideEffectTabBar" name="w77" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<y>90</y>
|
||||
<width>471</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
@ -166,6 +224,18 @@
|
||||
<header location="global">qqtprogressbar.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QQtSlideEffectTabBar</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qqtslideeffecttabbar.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QQtSlideEffectTabWidget</class>
|
||||
<extends>QTabWidget</extends>
|
||||
<header>qqtslideeffecttabwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "qqttabbar.h"
|
||||
#include "qqtpictureeffecttabbar.h"
|
||||
#include "QStylePainter"
|
||||
#include "QStyleOptionTabV3"
|
||||
#include "QDebug"
|
||||
@ -7,13 +7,13 @@
|
||||
#include "QToolButton"
|
||||
#include "qqtcore.h"
|
||||
|
||||
QQTTabBar::QQTTabBar(QWidget* parent) :
|
||||
QQtTabBar::QQtTabBar(QWidget* parent) :
|
||||
QTabBar(parent)
|
||||
{
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
}
|
||||
|
||||
void QQTTabBar::tabPixmap(int index, QImage& icon, QImage& iconSel)
|
||||
void QQtTabBar::tabPixmap(int index, QImage& icon, QImage& iconSel)
|
||||
{
|
||||
if (index < 0 || index + 1 > count() || index + 1 > iconList.size())
|
||||
return;
|
||||
@ -24,7 +24,7 @@ void QQTTabBar::tabPixmap(int index, QImage& icon, QImage& iconSel)
|
||||
return ;
|
||||
}
|
||||
|
||||
void QQTTabBar::setTabPixmap(int index, const QString& icon, const QString& iconSel)
|
||||
void QQtTabBar::setTabPixmap(int index, const QString& icon, const QString& iconSel)
|
||||
{
|
||||
if (index < 0 || index + 1 > count())
|
||||
return;
|
||||
@ -36,7 +36,7 @@ void QQTTabBar::setTabPixmap(int index, const QString& icon, const QString& icon
|
||||
iconList.insert(index, table);
|
||||
}
|
||||
|
||||
void QQTTabBar::paintEvent(QPaintEvent* e)
|
||||
void QQtTabBar::paintEvent(QPaintEvent* e)
|
||||
{
|
||||
Q_UNUSED(e)
|
||||
QStylePainter p(this);
|
||||
@ -61,7 +61,8 @@ void QQTTabBar::paintEvent(QPaintEvent* e)
|
||||
//p.drawItemPixmap(tabRectValue, Qt::AlignLeft |Qt::AlignTop, QPixmap::fromImage(image.scaled(tabRectValue.size(), Qt::KeepAspectRatio)));
|
||||
}
|
||||
|
||||
opt.palette.setColor(QPalette::Normal, QPalette::Text, QColor(255, 132, 0));
|
||||
//opt.palette.setColor(QPalette::Normal, QPalette::Text, QColor(255, 132, 0));
|
||||
opt.palette.setColor(QPalette::Normal, QPalette::Text, tabTextColor(index));
|
||||
opt.palette.setCurrentColorGroup(QPalette::Active);
|
||||
opt.state |= QStyle::State_Sunken;
|
||||
|
||||
@ -78,7 +79,7 @@ void QQTTabBar::paintEvent(QPaintEvent* e)
|
||||
}
|
||||
}
|
||||
|
||||
bool QQTTabBar::verticalTabs()
|
||||
bool QQtTabBar::verticalTabs()
|
||||
{
|
||||
return shape() == QTabBar::RoundedWest
|
||||
|| shape() == QTabBar::RoundedEast
|
@ -3,22 +3,23 @@
|
||||
|
||||
#include <QTabBar>
|
||||
#include <QList>
|
||||
#include <QColor>
|
||||
#include "qqtcore.h"
|
||||
#include "qqtwidgets.h"
|
||||
#include "qqt-local.h"
|
||||
|
||||
class QQTSHARED_EXPORT QQTTabBar : public QTabBar
|
||||
class QQTSHARED_EXPORT QQtTabBar : public QTabBar
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QQTTabBar(QWidget *parent = 0);
|
||||
explicit QQtTabBar(QWidget* parent = 0);
|
||||
|
||||
void tabPixmap(int index, QImage &icon, QImage &iconSel);
|
||||
void setTabPixmap(int index, const QString& icon = QString(), const QString &iconSel = QString());
|
||||
void tabPixmap(int index, QImage& icon, QImage& iconSel);
|
||||
void setTabPixmap(int index, const QString& icon = QString(), const QString& iconSel = QString());
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
void paintEvent(QPaintEvent*);
|
||||
inline bool verticalTabs();
|
||||
|
||||
public slots:
|
22
src/exquisite/qqtpictureeffecttabwidget.cpp
Normal file
22
src/exquisite/qqtpictureeffecttabwidget.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "qqtpictureeffecttabwidget.h"
|
||||
|
||||
QQtPictureEffectTabWidget::QQtPictureEffectTabWidget(QWidget* parent) : QQtTabWidget(parent)
|
||||
{
|
||||
m_bar = new QQtTabBar(this);
|
||||
setTabBar(m_bar);
|
||||
/*
|
||||
* pline() << "这是我设置的bar:" << bar;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void QQtPictureEffectTabWidget::setObjectName(const QString& name)
|
||||
{
|
||||
m_bar->setObjectName(QString("%1_bar").arg(name));
|
||||
return QQtTabWidget::setObjectName(name);
|
||||
}
|
||||
|
||||
QTabBar* QQtPictureEffectTabWidget::localTabBar() const
|
||||
{
|
||||
return m_bar;
|
||||
}
|
26
src/exquisite/qqtpictureeffecttabwidget.h
Normal file
26
src/exquisite/qqtpictureeffecttabwidget.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef QQTPICTUREEFFECTTABWIDGET_H
|
||||
#define QQTPICTUREEFFECTTABWIDGET_H
|
||||
|
||||
#include <qqttabwidget.h>
|
||||
#include <qqtpictureeffecttabbar.h>
|
||||
|
||||
class QQtPictureEffectTabWidget : public QQtTabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQtPictureEffectTabWidget(QWidget* parent = nullptr);
|
||||
virtual ~QQtPictureEffectTabWidget() {}
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
private:
|
||||
QQtTabBar* m_bar;
|
||||
|
||||
// QQtTabWidget interface
|
||||
public:
|
||||
virtual void setObjectName(const QString& name) override;
|
||||
virtual QTabBar* localTabBar() const override;
|
||||
};
|
||||
|
||||
#endif // QQTPICTUREEFFECTTABWIDGET_H
|
191
src/exquisite/qqtslideeffecttabbar.cpp
Normal file
191
src/exquisite/qqtslideeffecttabbar.cpp
Normal file
@ -0,0 +1,191 @@
|
||||
#include "qqtslideeffecttabbar.h"
|
||||
#include <QMouseEvent>
|
||||
#include <QPalette>
|
||||
#include <qqtcore.h>
|
||||
|
||||
QQtSlideEffectTabBar::QQtSlideEffectTabBar(QWidget* parent) : QTabBar(parent)
|
||||
{
|
||||
slideSpeed = 10;
|
||||
cornerRadius = 6;
|
||||
timer = new QTimer(this);
|
||||
timer->setInterval(100);
|
||||
timer->setSingleShot(true);
|
||||
connect(timer, SIGNAL(timeout()), this, SLOT(updateTabBarRect()));
|
||||
}
|
||||
|
||||
void QQtSlideEffectTabBar::setSlideSpeed(int slideSpeed)
|
||||
{
|
||||
if (this->slideSpeed != slideSpeed)
|
||||
{
|
||||
this->slideSpeed = slideSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
void QQtSlideEffectTabBar::setCornerRadius(int cornerRadius)
|
||||
{
|
||||
if (this->cornerRadius != cornerRadius)
|
||||
{
|
||||
this->cornerRadius = cornerRadius;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QQtSlideEffectTabBar::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
int width = this->width();
|
||||
int height = this->height();
|
||||
|
||||
/*绘制准备工作,启用反锯齿,等比例缩放*/
|
||||
QPainter painter(this);
|
||||
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
|
||||
|
||||
/*更改刻度 设置的是放大的倍数 */
|
||||
/*有利于在绘制的时候,统一绘制数据*/
|
||||
/*矢量放大,不失真*/
|
||||
/*
|
||||
* 不更改刻度,使用实际值
|
||||
*/
|
||||
//painter.scale(width / 200.0, height / 200.0);
|
||||
|
||||
drawBackground(&painter);
|
||||
drawTabBar(&painter);
|
||||
drawTabBarIcon(&painter);
|
||||
drawTabBarText(&painter);
|
||||
}
|
||||
|
||||
void QQtSlideEffectTabBar::drawBackground(QPainter* painter)
|
||||
{
|
||||
painter->save();
|
||||
QPalette pale = palette();
|
||||
painter->setBrush(pale.background());
|
||||
painter->drawRoundRect(rect(), cornerRadius, cornerRadius);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void QQtSlideEffectTabBar::drawTabBar(QPainter* painter)
|
||||
{
|
||||
painter->save();
|
||||
QPalette pale = palette();
|
||||
painter->setBrush(pale.button());
|
||||
painter->drawRoundedRect(m_barRect, cornerRadius, cornerRadius);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void QQtSlideEffectTabBar::drawTabBarIcon(QPainter* painter)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void QQtSlideEffectTabBar::drawTabBarText(QPainter* painter)
|
||||
{
|
||||
painter->save();
|
||||
for (int i = 0; i < count(); i++)
|
||||
{
|
||||
QPalette pale = palette();
|
||||
if (i == currentIndex())
|
||||
painter->setBrush(pale.buttonText());
|
||||
else
|
||||
painter->setBrush(pale.windowText());
|
||||
|
||||
QRect textRect = tabRect(i);
|
||||
painter->drawText(textRect, Qt::AlignCenter, tabText(i));
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
bool QQtSlideEffectTabBar::verticalTabs()
|
||||
{
|
||||
return shape() == QTabBar::RoundedWest
|
||||
|| shape() == QTabBar::RoundedEast
|
||||
|| shape() == QTabBar::TriangularWest
|
||||
|| shape() == QTabBar::TriangularEast;
|
||||
}
|
||||
|
||||
void QQtSlideEffectTabBar::updateTabBarRect()
|
||||
{
|
||||
if (m_targetRect.top() == m_barRect.top())
|
||||
{
|
||||
// right direction
|
||||
if (m_barRect.left() < m_targetRect.left())
|
||||
{
|
||||
if (m_barRect.left() + slideSpeed < m_targetRect.left())
|
||||
{
|
||||
m_barRect.setRect(m_barRect.left() + slideSpeed, m_barRect.top(),
|
||||
m_targetRect.width(), m_targetRect.height());
|
||||
timer->start();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_barRect = m_targetRect;
|
||||
}
|
||||
}
|
||||
// left direction
|
||||
else if (m_barRect.left() > m_targetRect.left())
|
||||
{
|
||||
if (m_barRect.left() - slideSpeed > m_targetRect.left())
|
||||
{
|
||||
m_barRect.setRect(m_barRect.left() - slideSpeed, m_barRect.top(),
|
||||
m_targetRect.width(), m_targetRect.height());
|
||||
timer->start();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_barRect = m_targetRect;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// down direction
|
||||
if (m_barRect.top() < m_targetRect.top())
|
||||
{
|
||||
if (m_barRect.top() + slideSpeed < m_targetRect.top())
|
||||
{
|
||||
m_barRect.setRect(m_barRect.left(), m_barRect.top() + slideSpeed,
|
||||
m_targetRect.width(), m_targetRect.height());
|
||||
timer->start();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_barRect = m_targetRect;
|
||||
}
|
||||
}
|
||||
// up direction
|
||||
else if (m_barRect.top() > m_targetRect.top())
|
||||
{
|
||||
if (m_barRect.top() - slideSpeed > m_targetRect.top())
|
||||
{
|
||||
m_barRect.setRect(m_barRect.left(), m_barRect.top() - slideSpeed,
|
||||
m_targetRect.width(), m_targetRect.height());
|
||||
timer->start();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_barRect = m_targetRect;
|
||||
}
|
||||
}
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void QQtSlideEffectTabBar::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
m_barRect = tabRect(currentIndex());
|
||||
for (int i = 0 ; i < count(); i++)
|
||||
{
|
||||
if (tabRect(i).contains(event->pos()) && i != currentIndex())
|
||||
{
|
||||
m_targetRect = tabRect(i);
|
||||
timer->start();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return QTabBar::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void QQtSlideEffectTabBar::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
return QTabBar::mouseReleaseEvent(event);
|
||||
}
|
68
src/exquisite/qqtslideeffecttabbar.h
Normal file
68
src/exquisite/qqtslideeffecttabbar.h
Normal file
@ -0,0 +1,68 @@
|
||||
#ifndef QQTSLIDEEFFECTTABBAR_H
|
||||
#define QQTSLIDEEFFECTTABBAR_H
|
||||
|
||||
/*
|
||||
* DrAbel set (QQ:2657635903) 2017年11月05日18:00:16
|
||||
* 功能完整,但是绘图的实现还太简单。
|
||||
*/
|
||||
|
||||
#include <QTabBar>
|
||||
#include <QPainter>
|
||||
#include <QTimer>
|
||||
|
||||
class QQtSlideEffectTabBar : public QTabBar
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQtSlideEffectTabBar(QWidget* parent = nullptr);
|
||||
virtual ~QQtSlideEffectTabBar() {}
|
||||
/**
|
||||
* @brief setSlideSpeed
|
||||
* 滑动速度 1-100 default:10
|
||||
* @return
|
||||
*/
|
||||
int getSlideSpeed() const { return slideSpeed; }
|
||||
void setSlideSpeed(int slideSpeed);
|
||||
/**
|
||||
* @brief getCornerRadius
|
||||
* Tab的圆角 1-70? default:6
|
||||
* @return
|
||||
*/
|
||||
int getCornerRadius() const { return cornerRadius; }
|
||||
void setCornerRadius(int cornerRadius);
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
protected:
|
||||
virtual void drawBackground(QPainter* painter);
|
||||
virtual void drawTabBar(QPainter* painter);
|
||||
virtual void drawTabBarIcon(QPainter* painter);
|
||||
virtual void drawTabBarText(QPainter* painter);
|
||||
|
||||
bool verticalTabs();
|
||||
|
||||
private slots:
|
||||
void updateTabBarRect();
|
||||
private:
|
||||
int slideSpeed;
|
||||
int cornerRadius;
|
||||
|
||||
QRect m_barRect;
|
||||
QRect m_targetRect;
|
||||
QTimer* timer;
|
||||
|
||||
// QWidget interface
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
|
||||
// QWidget interface
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent* event) override;
|
||||
|
||||
// QWidget interface
|
||||
protected:
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
};
|
||||
|
||||
#endif // QQTSLIDEEFFECTTABBAR_H
|
19
src/exquisite/qqtslideeffecttabwidget.cpp
Normal file
19
src/exquisite/qqtslideeffecttabwidget.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include "qqtslideeffecttabwidget.h"
|
||||
|
||||
QQtSlideEffectTabWidget::QQtSlideEffectTabWidget(QWidget* parent) : QQtTabWidget(parent)
|
||||
{
|
||||
m_bar = new QQtSlideEffectTabBar(this);
|
||||
setTabBar(m_bar);
|
||||
}
|
||||
|
||||
|
||||
void QQtSlideEffectTabWidget::setObjectName(const QString& name)
|
||||
{
|
||||
m_bar->setObjectName(QString("%1_bar").arg(name));
|
||||
return QQtTabWidget::setObjectName(name);
|
||||
}
|
||||
|
||||
QTabBar* QQtSlideEffectTabWidget::localTabBar() const
|
||||
{
|
||||
return m_bar;
|
||||
}
|
26
src/exquisite/qqtslideeffecttabwidget.h
Normal file
26
src/exquisite/qqtslideeffecttabwidget.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef QQTSLIDEEFFECTTABWIDGET_H
|
||||
#define QQTSLIDEEFFECTTABWIDGET_H
|
||||
|
||||
#include <qqttabwidget.h>
|
||||
#include <qqtslideeffecttabbar.h>
|
||||
|
||||
class QQtSlideEffectTabWidget : public QQtTabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQtSlideEffectTabWidget(QWidget* parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
QQtSlideEffectTabBar* m_bar;
|
||||
|
||||
// QQtTabWidget interface
|
||||
public:
|
||||
virtual void setObjectName(const QString& name) override;
|
||||
virtual QTabBar* localTabBar() const override;
|
||||
};
|
||||
|
||||
#endif // QQTSLIDEEFFECTTABWIDGET_H
|
@ -1,18 +1,14 @@
|
||||
#include "qqtdialog.h"
|
||||
#include "ui_qqtdialog.h"
|
||||
#include "QPainter"
|
||||
#include "QPainterPath"
|
||||
#include "qqtcore.h"
|
||||
#include <QIcon>
|
||||
|
||||
QQTDialog::QQTDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::QQTDialog)
|
||||
QQtDialog::QQtDialog(QWidget* parent) :
|
||||
QDialog(parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowModality(Qt::WindowModal);//阻挡父亲窗口内其他控件,除非本dialog关闭 show的功能强大起来 可以使用输入法
|
||||
|
||||
#if 0
|
||||
setWindowFlags(Qt::FramelessWindowHint|windowFlags());
|
||||
setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
||||
setAttribute(Qt::WA_TranslucentBackground, true);
|
||||
QPalette plt = palette();
|
||||
plt.setColor(QPalette::Normal, QPalette::Shadow, QColor(255, 149, 12, 255));
|
||||
@ -27,28 +23,6 @@ QQTDialog::QQTDialog(QWidget *parent) :
|
||||
setWindowIcon(QIcon("./skin/default/bk_logo.ico"));
|
||||
}
|
||||
|
||||
QQTDialog::~QQTDialog()
|
||||
QQtDialog::~QQtDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void QQTDialog::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
QDialog::paintEvent(e);
|
||||
return;
|
||||
|
||||
QPainter p(this);
|
||||
QPalette plt = palette();
|
||||
|
||||
/*
|
||||
* 半透明背景
|
||||
*/
|
||||
QPen pen;
|
||||
int border = 2;
|
||||
int radius = 4;
|
||||
pen.setWidth(border);
|
||||
pen.setColor(plt.color(QPalette::Normal, QPalette::Shadow));
|
||||
p.setPen(pen);
|
||||
p.setBrush(plt.brush(QPalette::Normal, QPalette::Window));
|
||||
p.drawRoundedRect(QRect(3, 3, rect().width()-border-3, rect().height()-border-3), radius, radius);
|
||||
}
|
||||
|
@ -4,27 +4,18 @@
|
||||
#include <QDialog>
|
||||
#include <qqt-local.h>
|
||||
|
||||
namespace Ui {
|
||||
class QQTDialog;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QSS
|
||||
*/
|
||||
class QQTSHARED_EXPORT QQTDialog : public QDialog
|
||||
class QQTSHARED_EXPORT QQtDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QQTDialog(QWidget *parent = 0);
|
||||
~QQTDialog();
|
||||
explicit QQtDialog(QWidget* parent = 0);
|
||||
virtual ~QQtDialog();
|
||||
|
||||
private:
|
||||
Ui::QQTDialog *ui;
|
||||
|
||||
// QWidget interface
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
};
|
||||
|
||||
#endif // QQTDIALOG_H
|
||||
|
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QQTDialog</class>
|
||||
<widget class="QDialog" name="QQTDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>441</width>
|
||||
<height>274</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -3,7 +3,7 @@
|
||||
#include "qqtcore.h"
|
||||
|
||||
QQTMsgBox::QQTMsgBox(QWidget *parent) :
|
||||
QQTDialog(parent),
|
||||
QQtDialog(parent),
|
||||
ui(new Ui::QQTMsgBox)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -12,7 +12,7 @@ class QQTMsgBox;
|
||||
* @brief The QQTMsgBox class
|
||||
*
|
||||
*/
|
||||
class QQTSHARED_EXPORT QQTMsgBox : public QQTDialog
|
||||
class QQTSHARED_EXPORT QQTMsgBox : public QQtDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QQTMsgBox</class>
|
||||
<widget class="QQTDialog" name="QQTMsgBox">
|
||||
<widget class="QQtDialog" name="QQTMsgBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@ -66,7 +66,7 @@
|
||||
<header>qqtpushbutton.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QQTDialog</class>
|
||||
<class>QQtDialog</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qqtdialog.h</header>
|
||||
<container>1</container>
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "ui_qqtpassworddialog.h"
|
||||
|
||||
QQTPasswordDialog::QQTPasswordDialog(QWidget *parent) :
|
||||
QQTDialog(parent),
|
||||
QQtDialog(parent),
|
||||
ui(new Ui::QQTPasswordDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -8,7 +8,7 @@ namespace Ui {
|
||||
class QQTPasswordDialog;
|
||||
}
|
||||
|
||||
class QQTSHARED_EXPORT QQTPasswordDialog : public QQTDialog
|
||||
class QQTSHARED_EXPORT QQTPasswordDialog : public QQtDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QQTPasswordDialog</class>
|
||||
<widget class="QQTDialog" name="QQTPasswordDialog">
|
||||
<widget class="QQtDialog" name="QQTPasswordDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@ -83,7 +83,7 @@
|
||||
<header>qqtpushbutton.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QQTDialog</class>
|
||||
<class>QQtDialog</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qqtdialog.h</header>
|
||||
<container>1</container>
|
||||
|
@ -3,9 +3,9 @@
|
||||
#include "qqtcore.h"
|
||||
#include "qqtobjectfactory.h"
|
||||
|
||||
QQTProgressDialog::QQTProgressDialog(QWidget *parent) :
|
||||
QQTDialog(parent),
|
||||
ui(new Ui::QQTProgressDialog)
|
||||
QQtProgressDialog::QQtProgressDialog(QWidget* parent) :
|
||||
QQtDialog(parent),
|
||||
ui(new Ui::QQtProgressDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
bar = ui->widgetBar;
|
||||
@ -25,9 +25,9 @@ QQTProgressDialog::QQTProgressDialog(QWidget *parent) :
|
||||
ui->btnCancel->setText("");
|
||||
ui->btnCancel->setFixedSize(104, 40);
|
||||
ui->btnCancel->iconTable().initNormal("./skin/default/bt_back_normal.png",
|
||||
"./skin/default/bt_back_press.png" );
|
||||
"./skin/default/bt_back_press.png");
|
||||
ui->btnCancel->iconTable().initOther("./skin/default/bt_back_hover.png",
|
||||
"./skin/default/bt_back_disable.png");
|
||||
"./skin/default/bt_back_disable.png");
|
||||
|
||||
ui->widgetBar->setPixMap("./skin/default/bk_progress_background.png",
|
||||
"./skin/default/bk_progress_chunk.png");
|
||||
@ -37,28 +37,28 @@ QQTProgressDialog::QQTProgressDialog(QWidget *parent) :
|
||||
QQTObjectFactory::registerObject(ui->btnCancel);
|
||||
}
|
||||
|
||||
QQTProgressDialog::~QQTProgressDialog()
|
||||
QQtProgressDialog::~QQtProgressDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void QQTProgressDialog::initAll()
|
||||
void QQtProgressDialog::initAll()
|
||||
{
|
||||
bar->setRange(0, 100);
|
||||
bar->setValue(0);
|
||||
}
|
||||
|
||||
void QQTProgressDialog::setRange(int min, int max)
|
||||
void QQtProgressDialog::setRange(int min, int max)
|
||||
{
|
||||
bar->setRange(min, max);
|
||||
}
|
||||
|
||||
void QQTProgressDialog::setContent(QString content)
|
||||
void QQtProgressDialog::setContent(QString content)
|
||||
{
|
||||
ui->label->setText(content);
|
||||
}
|
||||
|
||||
void QQTProgressDialog::setValue(int value)
|
||||
void QQtProgressDialog::setValue(int value)
|
||||
{
|
||||
bar->setValue(value);
|
||||
}
|
||||
|
@ -5,17 +5,18 @@
|
||||
#include "qqtdialog.h"
|
||||
#include "qqtprogressbar.h"
|
||||
|
||||
namespace Ui {
|
||||
class QQTProgressDialog;
|
||||
namespace Ui
|
||||
{
|
||||
class QQtProgressDialog;
|
||||
}
|
||||
|
||||
class QQTSHARED_EXPORT QQTProgressDialog : public QQTDialog
|
||||
class QQTSHARED_EXPORT QQtProgressDialog : public QQtDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QQTProgressDialog(QWidget *parent = 0);
|
||||
~QQTProgressDialog();
|
||||
explicit QQtProgressDialog(QWidget* parent = 0);
|
||||
~QQtProgressDialog();
|
||||
|
||||
void initAll();
|
||||
void setRange(int min, int max);
|
||||
@ -25,7 +26,7 @@ public slots:
|
||||
void setValue(int value);
|
||||
|
||||
private:
|
||||
Ui::QQTProgressDialog *ui;
|
||||
Ui::QQtProgressDialog* ui;
|
||||
QQTProgressBar* bar;
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QQTProgressDialog</class>
|
||||
<widget class="QQTDialog" name="QQTProgressDialog">
|
||||
<class>QQtProgressDialog</class>
|
||||
<widget class="QQtDialog" name="QQTProgressDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@ -57,7 +57,7 @@
|
||||
<header>qqtpushbutton.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QQTDialog</class>
|
||||
<class>QQtDialog</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qqtdialog.h</header>
|
||||
<container>1</container>
|
||||
|
@ -12,7 +12,6 @@
|
||||
SOURCES +=
|
||||
HEADERS +=
|
||||
|
||||
|
||||
#root dir
|
||||
win32 {
|
||||
#win32 base type
|
||||
@ -72,10 +71,8 @@ SOURCES += \
|
||||
$$PWD/widgets/qqtprogressbar.cpp \
|
||||
$$PWD/widgets/qqtpushbutton.cpp \
|
||||
$$PWD/widgets/qqtradiobutton.cpp \
|
||||
$$PWD/widgets/qqttabbar.cpp \
|
||||
$$PWD/widgets/qqttableview.cpp \
|
||||
$$PWD/widgets/qqttabwidget.cpp \
|
||||
$$PWD/widgets/qqttabwidgetb.cpp \
|
||||
$$PWD/widgets/qqttreeview.cpp \
|
||||
$$PWD/widgets/qqtlineeditwithsearch.cpp \
|
||||
$$PWD/widgets/qqtmptablewidget.cpp \
|
||||
@ -94,10 +91,8 @@ HEADERS += \
|
||||
$$PWD/widgets/qqtprogressbar.h \
|
||||
$$PWD/widgets/qqtpushbutton.h \
|
||||
$$PWD/widgets/qqtradiobutton.h \
|
||||
$$PWD/widgets/qqttabbar.h \
|
||||
$$PWD/widgets/qqttableview.h \
|
||||
$$PWD/widgets/qqttabwidget.h \
|
||||
$$PWD/widgets/qqttabwidgetb.h \
|
||||
$$PWD/widgets/qqttreeview.h \
|
||||
$$PWD/widgets/qqtlineeditwithsearch.h \
|
||||
$$PWD/widgets/qqtmptablewidget.h \
|
||||
@ -117,8 +112,6 @@ FORMS += \
|
||||
$$PWD/widgets/qqtpushbutton.ui \
|
||||
$$PWD/widgets/qqtradiobutton.ui \
|
||||
$$PWD/widgets/qqttableview.ui \
|
||||
$$PWD/widgets/qqttabwidget.ui \
|
||||
$$PWD/widgets/qqttabwidgetb.ui \
|
||||
$$PWD/widgets/qqttreeview.ui \
|
||||
$$PWD/widgets/qqtwidget.ui \
|
||||
$$PWD/widgets/qqttablewidget.ui \
|
||||
@ -280,43 +273,60 @@ HEADERS += \
|
||||
FORMS += \
|
||||
$$PWD/frame/qqtprogressdialog.ui \
|
||||
$$PWD/frame/qqtpassworddialog.ui \
|
||||
$$PWD/frame/qqtdialog.ui \
|
||||
$$PWD/frame/qqtinput.ui \
|
||||
$$PWD/frame/qqtmsgbox.ui
|
||||
|
||||
|
||||
contains (DEFINES, __EXQUISITE__) {
|
||||
#exquisite
|
||||
#progressbar
|
||||
SOURCES += \
|
||||
$$PWD/exquisite/qqtcustomspeedmeter.cpp \
|
||||
$$PWD/exquisite/qqtframelesshelper.cpp \
|
||||
$$PWD/exquisite/qqtframelesshelperprivate.cpp \
|
||||
$$PWD/exquisite/qqtcustompianokeyboard.cpp \
|
||||
$$PWD/exquisite/qqtrippleeffectpushbutton.cpp \
|
||||
$$PWD/exquisite/qqtrulereffectslider.cpp \
|
||||
$$PWD/exquisite/qqtflipeffectstackedwidget.cpp \
|
||||
$$PWD/exquisite/qqtledbannereffectlabel.cpp \
|
||||
$$PWD/exquisite/qqtmarqueeeffectlabel.cpp \
|
||||
$$PWD/exquisite/qqtcustomverificationcode.cpp \
|
||||
$$PWD/exquisite/qqtfadeeffectwidget.cpp \
|
||||
$$PWD/exquisite/qqtshadoweffectwidget.cpp \
|
||||
$$PWD/exquisite/qqtpopeffectdialog.cpp \
|
||||
$$PWD/exquisite/qqtcustomeffectprogressbar.cpp
|
||||
HEADERS += \
|
||||
$$PWD/exquisite/qqtcustomspeedmeter.h \
|
||||
$$PWD/exquisite/qqtcustomeffectprogressbar.h
|
||||
#label
|
||||
SOURCES += \
|
||||
$$PWD/exquisite/qqtledbannereffectlabel.cpp \
|
||||
$$PWD/exquisite/qqtmarqueeeffectlabel.cpp
|
||||
HEADERS += \
|
||||
$$PWD/exquisite/qqtmarqueeeffectlabel.h \
|
||||
$$PWD/exquisite/qqtledbannereffectlabel.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/exquisite/qqtcustompianokeyboard.cpp \
|
||||
$$PWD/exquisite/qqtrippleeffectpushbutton.cpp \
|
||||
$$PWD/exquisite/qqtrulereffectslider.cpp \
|
||||
$$PWD/exquisite/qqtcustomverificationcode.cpp \
|
||||
$$PWD/exquisite/qqtframelesshelper.cpp \
|
||||
$$PWD/exquisite/qqtframelesshelperprivate.cpp \
|
||||
$$PWD/exquisite/qqtflipeffectstackedwidget.cpp \
|
||||
$$PWD/exquisite/qqtfadeeffectwidget.cpp \
|
||||
$$PWD/exquisite/qqtshadoweffectwidget.cpp \
|
||||
$$PWD/exquisite/qqtpopeffectdialog.cpp
|
||||
HEADERS += \
|
||||
$$PWD/exquisite/qqtframelesshelper.h \
|
||||
$$PWD/exquisite/qqtframelesshelperprivate.h \
|
||||
$$PWD/exquisite/qqtcustompianokeyboard.h \
|
||||
$$PWD/exquisite/qqtrippleeffectpushbutton.h \
|
||||
$$PWD/exquisite/qqtrulereffectslider.h \
|
||||
$$PWD/exquisite/qqtflipeffectstackedwidget.h \
|
||||
$$PWD/exquisite/qqtmarqueeeffectlabel.h \
|
||||
$$PWD/exquisite/qqtledbannereffectlabel.h \
|
||||
$$PWD/exquisite/qqtcustomverificationcode.h \
|
||||
$$PWD/exquisite/qqtfadeeffectwidget.h \
|
||||
$$PWD/exquisite/qqtshadoweffectwidget.h \
|
||||
$$PWD/exquisite/qqtpopeffectdialog.h \
|
||||
$$PWD/exquisite/qqtcustomeffectprogressbar.h
|
||||
$$PWD/exquisite/qqtpopeffectdialog.h
|
||||
#tabwidget
|
||||
SOURCES += \
|
||||
$$PWD/exquisite/qqtpictureeffecttabbar.cpp \
|
||||
$$PWD/exquisite/qqtslideeffecttabbar.cpp \
|
||||
$$PWD/exquisite/qqtpictureeffecttabwidget.cpp \
|
||||
$$PWD/exquisite/qqtslideeffecttabwidget.cpp
|
||||
HEADERS += \
|
||||
$$PWD/exquisite/qqtpictureeffecttabbar.h \
|
||||
$$PWD/exquisite/qqtslideeffecttabbar.h \
|
||||
$$PWD/exquisite/qqtpictureeffecttabwidget.h \
|
||||
$$PWD/exquisite/qqtslideeffecttabwidget.h
|
||||
}
|
||||
|
||||
#qrcode
|
||||
|
@ -1,34 +1,21 @@
|
||||
#include "qqttabwidget.h"
|
||||
#include "ui_qqttabwidget.h"
|
||||
#include "qqttabbar.h"
|
||||
#include <QDebug>
|
||||
#include <QPainter>
|
||||
#include <QStylePainter>
|
||||
#include <QStyleOptionTabWidgetFrameV2>
|
||||
#include "qqtcore.h"
|
||||
#include <QTabBar>
|
||||
|
||||
QQTTabWidget::QQTTabWidget(QWidget *parent) :
|
||||
QTabWidget(parent),
|
||||
ui(new Ui::QQTTabWidget)
|
||||
QQtTabWidget::QQtTabWidget(QWidget* parent) :
|
||||
QTabWidget(parent)
|
||||
{
|
||||
m_bar = new QQTTabBar(this);
|
||||
setTabBar(m_bar);
|
||||
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
QQTTabWidget::~QQTTabWidget()
|
||||
QQtTabWidget::~QQtTabWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QQTTabBar *QQTTabWidget::cTabBar()
|
||||
void QQtTabWidget::setObjectName(const QString& name)
|
||||
{
|
||||
return m_bar;
|
||||
}
|
||||
|
||||
void QQTTabWidget::setObjectName(const QString &name)
|
||||
{
|
||||
m_bar->setObjectName(QString("%1_bar").arg(name));
|
||||
tabBar()->setObjectName(QString("%1_bar").arg(name));
|
||||
/*
|
||||
* pline() << "系统tabBar的类指针被替换掉了吗?" << tabBar();
|
||||
*/
|
||||
QTabWidget::setObjectName(name);
|
||||
}
|
||||
|
@ -2,30 +2,52 @@
|
||||
#define QQTTABWIDGET_H
|
||||
|
||||
#include <QTabWidget>
|
||||
#include "qqttabbar.h"
|
||||
#include "qqt-local.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class QQTTabWidget;
|
||||
}
|
||||
|
||||
class QQTSHARED_EXPORT QQTTabWidget : public QTabWidget
|
||||
class QQTSHARED_EXPORT QQtTabWidget : public QTabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QQTTabWidget(QWidget* parent = 0);
|
||||
~QQTTabWidget();
|
||||
|
||||
QQTTabBar* cTabBar();
|
||||
void setObjectName(const QString& name);
|
||||
void setToolTipDuration(int index) { Q_UNUSED(index) ; }
|
||||
explicit QQtTabWidget(QWidget* parent = 0);
|
||||
~QQtTabWidget();
|
||||
/**
|
||||
* @brief setObjectName
|
||||
* 为了设置tabbar的objectname,内部的设置不清晰。
|
||||
* 子类必须override一次,否则会找不到自己的tabbar
|
||||
* override 不支持c++ 多继承中的其中一个父类里的函数? 似乎不支持父类中不带virtual的函数
|
||||
* @param name
|
||||
*/
|
||||
virtual void setObjectName(const QString& name) /*override*/;
|
||||
/**
|
||||
* @brief setToolTipDuration
|
||||
* bug? unset cause compiler error...
|
||||
* @param msec
|
||||
*/
|
||||
virtual void setToolTipDuration(int msec) /*override*/ { return QTabWidget::setToolTipDuration(msec) ; }
|
||||
/**
|
||||
* @brief localTabBar
|
||||
* 在setTabBar以后,系统tabBar和这个Bar不一样。
|
||||
* 返回本地设置的tabbar,给子类用的,父类返回系统tabBar,不可用!
|
||||
* 用于eventfilter
|
||||
* @return
|
||||
*/
|
||||
virtual QTabBar* localTabBar() const { return QTabWidget::tabBar(); }
|
||||
/**
|
||||
* @brief tabBar
|
||||
* 用于eventfilter
|
||||
* @return
|
||||
*/
|
||||
virtual QTabBar* tabBar() const /*override*/ { return QTabWidget::tabBar(); }
|
||||
/**
|
||||
* @brief setTabBar
|
||||
* 这个函数是个炸弹,必须在子类的构造函数中,带ui的在setupUI之前,调动,否则不起作用。
|
||||
* @param b
|
||||
*/
|
||||
virtual void setTabBar(QTabBar* b) /*override*/ { return QTabWidget::setTabBar(b); }
|
||||
|
||||
private:
|
||||
Ui::QQTTabWidget* ui;
|
||||
|
||||
QQTTabBar* m_bar;
|
||||
};
|
||||
|
||||
#endif // QQTTABWIDGET_H
|
||||
|
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QQTTabWidget</class>
|
||||
<widget class="QTabWidget" name="QQTTabWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>327</width>
|
||||
<height>179</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>TabWidget</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,14 +0,0 @@
|
||||
#include "qqttabwidgetb.h"
|
||||
#include "ui_qqttabwidgetb.h"
|
||||
|
||||
QQTTabWidgetB::QQTTabWidgetB(QWidget *parent) :
|
||||
QTabWidget(parent),
|
||||
ui(new Ui::QQTTabWidgetB)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
QQTTabWidgetB::~QQTTabWidgetB()
|
||||
{
|
||||
delete ui;
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
#ifndef QQTTABWIDGETB_H
|
||||
#define QQTTABWIDGETB_H
|
||||
|
||||
#include <QTabWidget>
|
||||
#include <qqt-local.h>
|
||||
|
||||
namespace Ui {
|
||||
class QQTTabWidgetB;
|
||||
}
|
||||
|
||||
class QQTSHARED_EXPORT QQTTabWidgetB : public QTabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QQTTabWidgetB(QWidget *parent = 0);
|
||||
~QQTTabWidgetB();
|
||||
|
||||
QTabBar* tabBar() { return QTabWidget::tabBar(); }
|
||||
|
||||
private:
|
||||
Ui::QQTTabWidgetB *ui;
|
||||
};
|
||||
|
||||
#endif // QQTTABWIDGETB_H
|
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QQTTabWidgetB</class>
|
||||
<widget class="QTabWidget" name="QQTTabWidgetB">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>TabWidget</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
x
Reference in New Issue
Block a user