diff options
-rw-r--r-- | qt-ui/listfilter.ui | 2 | ||||
-rw-r--r-- | qt-ui/mainwindow.ui | 6 | ||||
-rw-r--r-- | qt-ui/simplewidgets.cpp | 18 | ||||
-rw-r--r-- | qt-ui/simplewidgets.h | 14 |
4 files changed, 25 insertions, 15 deletions
diff --git a/qt-ui/listfilter.ui b/qt-ui/listfilter.ui index 2aec3e4c5..0588afb24 100644 --- a/qt-ui/listfilter.ui +++ b/qt-ui/listfilter.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>400</width> - <height>300</height> + <height>166</height> </rect> </property> <property name="windowTitle"> diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui index 8e5be3f64..7b75c2802 100644 --- a/qt-ui/mainwindow.ui +++ b/qt-ui/mainwindow.ui @@ -28,6 +28,9 @@ <number>0</number> </property> <item> + <widget class="MultiFilter" name="multiFilter" native="true"/> + </item> + <item> <widget class="QSplitter" name="mainSplitter"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -126,9 +129,6 @@ <widget class="QWidget" name="page_3"> <layout class="QVBoxLayout" name="verticalLayout_4"> <item> - <widget class="MultiFilter" name="multiFilter" native="true"/> - </item> - <item> <widget class="DiveListView" name="ListWidget"> <property name="selectionMode"> <enum>QAbstractItemView::ExtendedSelection</enum> diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index a5707c34d..522ed30e9 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -536,13 +536,23 @@ MultiFilter::MultiFilter(QWidget *parent) : QScrollArea(parent) QWidget *w = new QWidget(); QHBoxLayout *l = new QHBoxLayout(); - l->addWidget(new TagFilter()); + TagFilter *tagFilter = new TagFilter(); + int minimumHeight = tagFilter->ui.filterInternalList->height() + + tagFilter->ui.verticalLayout->spacing() * tagFilter->ui.verticalLayout->count(); + + QListView *dummyList = new QListView(); + QStringListModel *dummy = new QStringListModel(QStringList() << "Dummy Text"); + dummyList->setModel(dummy); + + l->addWidget(tagFilter); l->addWidget(new BuddyFilter()); l->addWidget(new LocationFilter()); - l->setContentsMargins(0, 0, 0, 0); - l->setSpacing(1); + l->setSpacing(0); + w->setLayout(l); - w->setMinimumSize(l->count() * 150, 200); setWidget(w); + w->resize(w->width(), minimumHeight + dummyList->sizeHintForRow(0) * 5 ); + + setMinimumHeight(w->height()); } diff --git a/qt-ui/simplewidgets.h b/qt-ui/simplewidgets.h index 5fbdad613..b33dd8f9a 100644 --- a/qt-ui/simplewidgets.h +++ b/qt-ui/simplewidgets.h @@ -130,6 +130,12 @@ private: struct dive_components *what; }; +class MultiFilter : public QScrollArea { + Q_OBJECT +public: + MultiFilter(QWidget *parent); +}; + class TagFilter : public QWidget { Q_OBJECT public: @@ -139,6 +145,7 @@ public: private: Ui::FilterWidget ui; + friend class MultiFilter; }; class BuddyFilter : public QWidget { @@ -163,13 +170,6 @@ private: Ui::FilterWidget ui; }; - -class MultiFilter : public QScrollArea { - Q_OBJECT -public: - MultiFilter(QWidget *parent); -}; - bool isGnome3Session(); QImage grayImage(const QImage &coloredImg); |