dtkwidget: update to 2.0.9.

This commit is contained in:
John 2018-07-21 00:07:12 +02:00 committed by maxice8
parent b697e98aa7
commit de298ba7a9
4 changed files with 3 additions and 374 deletions

View File

@ -1,323 +0,0 @@
diff --git a/debian/libdtkwidget2.symbols debian/libdtkwidget2.symbols
index b801671..fbd6bca 100644
--- a/debian/libdtkwidget2.symbols
+++ debian/libdtkwidget2.symbols
@@ -1373,12 +1373,10 @@ libdtkwidget.so.2 libdtkwidget2 #MINVER#
_ZN3Dtk6Widget14DTabBarPrivate11makeVisibleEi@Base 2.0.7.2
_ZN3Dtk6Widget14DTabBarPrivate11qt_metacallEN11QMetaObject4CallEiPPv@Base 2.0.7.2
_ZN3Dtk6Widget14DTabBarPrivate11qt_metacastEPKc@Base 2.0.7.2
- _ZN3Dtk6Widget14DTabBarPrivate11resizeEventEP12QResizeEvent@Base 2.0.7.2
_ZN3Dtk6Widget14DTabBarPrivate11tabInsertedEi@Base 2.0.7.2
_ZN3Dtk6Widget14DTabBarPrivate13dragMoveEventEP14QDragMoveEvent@Base 2.0.7.2
_ZN3Dtk6Widget14DTabBarPrivate13layoutWidgetsEi@Base 2.0.7.2
_ZN3Dtk6Widget14DTabBarPrivate13startTabFlashEv@Base 2.0.7.2
- _ZN3Dtk6Widget14DTabBarPrivate13updateTabSizeEv@Base 2.0.7.2
_ZN3Dtk6Widget14DTabBarPrivate14autoScrollTabsERK6QPoint@Base 2.0.7.2
_ZN3Dtk6Widget14DTabBarPrivate14dragEnterEventEP15QDragEnterEvent@Base 2.0.7.2
_ZN3Dtk6Widget14DTabBarPrivate14dragLeaveEventEP15QDragLeaveEvent@Base 2.0.7.2
@@ -3721,7 +3719,6 @@ libdtkwidget.so.2 libdtkwidget2 #MINVER#
_ZNK3Dtk6Widget14DTabBarPrivate11tabSizeHintEi@Base 2.0.7.2
_ZNK3Dtk6Widget14DTabBarPrivate15initStyleOptionEP15QStyleOptionTabi@Base 2.0.7.2
_ZNK3Dtk6Widget14DTabBarPrivate15minimumSizeHintEv@Base 2.0.7.2
- _ZNK3Dtk6Widget14DTabBarPrivate18maximumTabSizeHintEi@Base 2.0.7.2
_ZNK3Dtk6Widget14DTabBarPrivate18minimumTabSizeHintEi@Base 2.0.7.2
_ZNK3Dtk6Widget14DWaterProgress10metaObjectEv@Base 2.0.7.2
_ZNK3Dtk6Widget14DWaterProgress5valueEv@Base 2.0.7.2
diff --git a/src/widgets/dtabbar.cpp src/widgets/dtabbar.cpp
index 28ff328..7d1173b 100644
--- a/src/widgets/dtabbar.cpp
+++ src/widgets/dtabbar.cpp
@@ -24,7 +24,6 @@
#include "dthememanager.h"
#include <QPainter>
-#include <QApplication>
#include <QMouseEvent>
#include <QStyleOption>
#include <QStylePainter>
@@ -44,6 +43,8 @@
#undef private
#undef protected
+#include "dapplication.h"
+
DWIDGET_BEGIN_NAMESPACE
inline static bool verticalTabs(QTabBar::Shape shape)
@@ -230,11 +231,9 @@ class DTabBarPrivate : public QTabBar, public DObjectPrivate
void dragMoveEvent(QDragMoveEvent *e) override;
void dropEvent(QDropEvent *e) override;
void showEvent(QShowEvent *e) override;
- void resizeEvent(QResizeEvent *e) override;
QSize tabSizeHint(int index) const override;
QSize minimumTabSizeHint(int index) const override;
- virtual QSize maximumTabSizeHint(int index) const;
void tabInserted(int index) override;
void tabRemoved(int index) override;
@@ -258,7 +257,6 @@ class DTabBarPrivate : public QTabBar, public DObjectPrivate
void stopAutoScrollTabs();
void ensureScrollTabsAnimation();
- void updateTabSize();
void startTabFlash();
void setDragingFromOther(bool v);
@@ -737,28 +735,6 @@ void DTabBarPrivate::ensureScrollTabsAnimation()
});
}
-void DTabBarPrivate::updateTabSize()
-{
- QTabBarPrivate *d = reinterpret_cast<QTabBarPrivate *>(qGetPtrHelper(d_ptr));
-
- bool is_vertical = verticalTabs(d->shape);
-
- for (int i = 0; i < d->tabList.count(); ++i) {
- QTabBarPrivate::Tab &tab = d->tabList[i];
- const QSize &size_hint = tabSizeHint(i);
- const QSize old_size = tab.rect.size();
-
- if (is_vertical) {
- tab.rect.setWidth(qMax(size_hint.width(), width()));
- } else {
- tab.rect.setHeight(qMax(size_hint.height(), height()));
- }
-
- if (tab.rect.size() != old_size)
- layoutTab(i);
- }
-}
-
void DTabBarPrivate::startTabFlash()
{
QVariantAnimation *animation = new QVariantAnimation(this);
@@ -1202,27 +1178,27 @@ void DTabBarPrivate::showEvent(QShowEvent *e)
QTabBar::showEvent(e);
}
-void DTabBarPrivate::resizeEvent(QResizeEvent *e)
+QSize DTabBarPrivate::tabSizeHint(int index) const
{
- updateTabSize();
+ D_QC(DTabBar);
+
+ if (qApp->buildDtkVersion() > DTK_VERSION_CHECK(2, 0, 8, 1))
+ return q->tabSizeHint(index);
- QTabBar::resizeEvent(e);
+ return q->DTabBar::tabSizeHint(index);
}
-QSize DTabBarPrivate::tabSizeHint(int index) const
+QSize DTabBarPrivate::minimumTabSizeHint(int index) const
{
D_QC(DTabBar);
- QSize size = QTabBar::tabSizeHint(index);
-
- if (index >= tabMaximumSize.count())
- return size;
+ const QSize &min = qApp->buildDtkVersion() > DTK_VERSION_CHECK(2, 0, 8, 1) ? q->minimumTabSizeHint(index) : q->DTabBar::minimumTabSizeHint(index);
- const QSize &min = tabMinimumSize.at(index);
- const QSize &max = tabMaximumSize.at(index);
+ if (min.isValid())
+ return min;
- size.setWidth(qMax(size.width(), min.width()));
- size.setHeight(qMax(size.height(), min.height()));
+ QSize size = QTabBar::tabSizeHint(index);
+ const QSize &max = qApp->buildDtkVersion() > DTK_VERSION_CHECK(2, 0, 8, 1) ? q->maximumTabSizeHint(index) : q->DTabBar::maximumTabSizeHint(index);
if (max.isValid()) {
size.setWidth(qMin(size.width(), max.width()));
@@ -1232,47 +1208,34 @@ QSize DTabBarPrivate::tabSizeHint(int index) const
return size;
}
-QSize DTabBarPrivate::minimumTabSizeHint(int index) const
-{
- const QSize &min = tabMinimumSize.value(index);
-
- if (min.isValid())
- return min;
-
- return QTabBar::minimumTabSizeHint(index);
-}
-
-QSize DTabBarPrivate::maximumTabSizeHint(int index) const
-{
- const QSize &max = tabMaximumSize.value(index);
-
- if (max.isValid())
- return max;
-
- return QTabBar::tabSizeHint(index);
-}
-
void DTabBarPrivate::tabInserted(int index)
{
- tabMaximumSize.insert(index, QSize());
- tabMinimumSize.insert(index, QSize());
+ D_Q(DTabBar);
- QTabBar::tabInserted(index);
+ if (qApp->buildDtkVersion() > DTK_VERSION_CHECK(2, 0, 8, 1))
+ q->tabInserted(index);
+ else
+ q->DTabBar::tabInserted(index);
}
void DTabBarPrivate::tabRemoved(int index)
{
- tabMaximumSize.removeAt(index);
- tabMinimumSize.removeAt(index);
+ D_Q(DTabBar);
- QTabBar::tabInserted(index);
+ if (qApp->buildDtkVersion() > DTK_VERSION_CHECK(2, 0, 8, 1))
+ q->tabRemoved(index);
+ else
+ q->DTabBar::tabRemoved(index);
}
void DTabBarPrivate::tabLayoutChange()
{
- updateTabSize();
+ D_Q(DTabBar);
- QTabBar::tabLayoutChange();
+ if (qApp->buildDtkVersion() > DTK_VERSION_CHECK(2, 0, 8, 1))
+ q->tabLayoutChange();
+ else
+ q->DTabBar::tabLayoutChange();
}
void DTabBarPrivate::initStyleOption(QStyleOptionTab *option, int tabIndex) const
@@ -1296,14 +1259,28 @@ void DTabBar::setTabMinimumSize(int index, const QSize &size)
{
D_D(DTabBar);
+ if (d->tabMinimumSize.at(index) == size)
+ return;
+
d->tabMinimumSize[index] = size;
+
+ QTabBarPrivate *dd = reinterpret_cast<QTabBarPrivate *>(qGetPtrHelper(d->d_ptr));
+
+ dd->layoutDirty = true;
}
void DTabBar::setTabMaximumSize(int index, const QSize &size)
{
D_D(DTabBar);
+ if (d->tabMaximumSize.at(index) == size)
+ return;
+
d->tabMaximumSize[index] = size;
+
+ QTabBarPrivate *dd = reinterpret_cast<QTabBarPrivate *>(qGetPtrHelper(d->d_ptr));
+
+ dd->layoutDirty = true;
}
bool DTabBar::visibleAddButton() const
@@ -1865,6 +1842,76 @@ void DTabBar::insertFromMimeDataOnDragEnter(int index, const QMimeData *source)
startTabFlash(insertTab(index, source->text()));
}
+void DTabBar::tabInserted(int index)
+{
+ D_D(DTabBar);
+
+ d->tabMaximumSize.insert(index, QSize());
+ d->tabMinimumSize.insert(index, QSize());
+
+ d->QTabBar::tabInserted(index);
+}
+
+void DTabBar::tabLayoutChange()
+{
+ D_D(DTabBar);
+
+ d->QTabBar::tabLayoutChange();
+}
+
+void DTabBar::tabRemoved(int index)
+{
+ D_D(DTabBar);
+
+ d->tabMaximumSize.removeAt(index);
+ d->tabMinimumSize.removeAt(index);
+
+ d->QTabBar::tabRemoved(index);
+}
+
+QSize DTabBar::tabSizeHint(int index) const
+{
+ D_DC(DTabBar);
+
+ QSize size = d->QTabBar::tabSizeHint(index);
+
+ QTabBarPrivate *dd = reinterpret_cast<QTabBarPrivate *>(qGetPtrHelper(d->d_ptr));
+ bool is_vertical = verticalTabs(dd->shape);
+
+ if (is_vertical) {
+ size.setWidth(qMax(size.width(), d->width()));
+ } else {
+ size.setHeight(qMax(size.height(), d->height()));
+ }
+
+ const QSize &min = qApp->buildDtkVersion() > DTK_VERSION_CHECK(2, 0, 8, 1) ? minimumTabSizeHint(index) : DTabBar::minimumTabSizeHint(index);
+ const QSize &max = qApp->buildDtkVersion() > DTK_VERSION_CHECK(2, 0, 8, 1) ? maximumTabSizeHint(index) : DTabBar::maximumTabSizeHint(index);
+
+ size.setWidth(qMax(size.width(), min.width()));
+ size.setHeight(qMax(size.height(), min.height()));
+
+ if (max.isValid()) {
+ size.setWidth(qMin(size.width(), max.width()));
+ size.setHeight(qMin(size.height(), max.height()));
+ }
+
+ return size;
+}
+
+QSize DTabBar::minimumTabSizeHint(int index) const
+{
+ D_DC(DTabBar);
+
+ return d->tabMinimumSize.value(index);
+}
+
+QSize DTabBar::maximumTabSizeHint(int index) const
+{
+ D_DC(DTabBar);
+
+ return d->tabMaximumSize.value(index);
+}
+
DTabBarPrivate *DTabBar::d_func()
{
return dynamic_cast<DTabBarPrivate*>(d_d_ptr.data());
diff --git a/src/widgets/dtabbar.h src/widgets/dtabbar.h
index 16b71f1..aca8eb8 100644
--- a/src/widgets/dtabbar.h
+++ src/widgets/dtabbar.h
@@ -195,6 +195,14 @@ public Q_SLOTS:
virtual void insertFromMimeData(int index, const QMimeData *source);
virtual void insertFromMimeDataOnDragEnter(int index, const QMimeData *source);
+ virtual void tabInserted(int index);
+ virtual void tabLayoutChange();
+ virtual void tabRemoved(int index);
+
+ virtual QSize tabSizeHint(int index) const;
+ virtual QSize minimumTabSizeHint(int index) const;
+ virtual QSize maximumTabSizeHint(int index) const;
+
private:
DTabBarPrivate* d_func();
const DTabBarPrivate* d_func() const;

View File

@ -1,35 +0,0 @@
diff --git a/src/widgets/dtabbar.cpp src/widgets/dtabbar.cpp
index 7d1173b..d034c69 100644
--- a/src/widgets/dtabbar.cpp
+++ src/widgets/dtabbar.cpp
@@ -1850,6 +1850,8 @@ void DTabBar::tabInserted(int index)
d->tabMinimumSize.insert(index, QSize());
d->QTabBar::tabInserted(index);
+
+ Q_EMIT tabIsInserted(index);
}
void DTabBar::tabLayoutChange()
@@ -1867,6 +1869,8 @@ void DTabBar::tabRemoved(int index)
d->tabMinimumSize.removeAt(index);
d->QTabBar::tabRemoved(index);
+
+ Q_EMIT tabIsRemoved(index);
}
QSize DTabBar::tabSizeHint(int index) const
diff --git a/src/widgets/dtabbar.h src/widgets/dtabbar.h
index aca8eb8..f560ede 100644
--- a/src/widgets/dtabbar.h
+++ src/widgets/dtabbar.h
@@ -158,6 +158,8 @@ class DTabBar : public QWidget, public DObject
void currentChanged(int index);
void tabCloseRequested(int index);
void tabMoved(int from, int to);
+ void tabIsInserted(int index);
+ void tabIsRemoved(int index);
void tabBarClicked(int index);
void tabBarDoubleClicked(int index);
void tabAddRequested();

View File

@ -1,13 +0,0 @@
diff --git a/src/widgets/dtabbar.cpp src/widgets/dtabbar.cpp
index d034c69..479bb39 100644
--- a/src/widgets/dtabbar.cpp
+++ src/widgets/dtabbar.cpp
@@ -1757,6 +1757,8 @@ void DTabBar::dropEvent(QDropEvent *e)
Q_UNUSED(blocker)
d->removeTab(d->ghostTabIndex);
}
+ Q_EMIT tabIsRemoved(d->ghostTabIndex);
+
insertFromMimeData(d->ghostTabIndex, e->mimeData());
d->ghostTabIndex = -1;
} else {

View File

@ -1,7 +1,7 @@
# Template file for 'dtkwidget' # Template file for 'dtkwidget'
pkgname=dtkwidget pkgname=dtkwidget
version=2.0.8.1 version=2.0.9
revision=2 revision=1
build_style=qmake build_style=qmake
configure_args="DBUS_VERSION_0_4_2=YES LIB_INSTALL_DIR=/usr/lib" configure_args="DBUS_VERSION_0_4_2=YES LIB_INSTALL_DIR=/usr/lib"
hostmakedepends="pkg-config qt5-host-tools qt5-qmake" hostmakedepends="pkg-config qt5-host-tools qt5-qmake"
@ -14,7 +14,7 @@ license="GPL-3.0-or-later"
homepage="https://github.com/linuxdeepin/dtkwidget" homepage="https://github.com/linuxdeepin/dtkwidget"
changelog="https://github.com/linuxdeepin/dtkwidget/blob/${version}/CHANGELOG.md" changelog="https://github.com/linuxdeepin/dtkwidget/blob/${version}/CHANGELOG.md"
distfiles="https://github.com/linuxdeepin/dtkwidget/archive/${version}.tar.gz" distfiles="https://github.com/linuxdeepin/dtkwidget/archive/${version}.tar.gz"
checksum=99d9498da5f74ce56812abfdd8dda1f995e8e83a2530e8a0b711811732fc0df6 checksum=37ed3f2a3e0b0240f6fbeb999b6437e64c15f5218c6effc3cdd0b7a58d57a29f
if [ "$CROSS_BUILD" ]; then if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" dtkcore-devel qt5-multimedia-devel qt5-x11extras-devel hostmakedepends+=" dtkcore-devel qt5-multimedia-devel qt5-x11extras-devel