Skip to content

Commit

Permalink
liteapp: fix #1106, options widget add ScrollArea, enable resize, ini…
Browse files Browse the repository at this point in the history
…t check screen size
  • Loading branch information
visualfc committed Mar 22, 2020
1 parent 4b1cc10 commit 8dcc723
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 16 deletions.
13 changes: 13 additions & 0 deletions liteidex/src/liteapp/optionmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include "optionmanager.h"
#include "optionsbrowser.h"
#include <QAction>
#include <QApplication>
#include <QDesktopWidget>
//lite_memory_check_begin
#if defined(WIN32) && defined(_MSC_VER) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
Expand Down Expand Up @@ -79,6 +81,17 @@ void OptionManager::exec(const QString &mimeType)
{
if (!m_browser) {
m_browser = new OptionsBrowser(m_liteApp,m_liteApp->mainWindow());
QRect rc = qApp->desktop()->screenGeometry(m_browser);
int width = rc.width();
if (width > 900) {
width = 900;
}
int height = rc.height();
if (height > 600) {
height = 600;
}
m_browser->resize(width,height);

connect(m_browser,SIGNAL(applyOption(QString)),this,SIGNAL(applyOption(QString)));
foreach (IOptionFactory *f, m_factoryList) {
QStringList mimeTypes = f->mimeTypes();
Expand Down
13 changes: 7 additions & 6 deletions liteidex/src/liteapp/optionsbrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,15 @@ int OptionsBrowser::execute(const QString &mimeType)
ui->listWidget->setCurrentItem(item);
LiteApi::IOption *opt = m_widgetOptionMap.value(item);
if (opt) {
//ui->scrollArea->resize(opt->widget()->size());
opt->load();
}
this->setMinimumHeight(600);
#ifdef Q_OS_MAC
this->setMinimumWidth(900);
#else
this->setMinimumWidth(800);
#endif
// this->setMinimumHeight(600);
//#ifdef Q_OS_MAC
// this->setMinimumWidth(900);
//#else
// this->setMinimumWidth(800);
//#endif
return exec();
}

Expand Down
54 changes: 44 additions & 10 deletions liteidex/src/liteapp/optionswidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,21 @@
<rect>
<x>0</x>
<y>0</y>
<width>654</width>
<height>294</height>
<width>602</width>
<height>304</height>
</rect>
</property>
<property name="windowTitle">
<string>Options</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,10">
<property name="sizeGripEnabled">
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">
<item>
<widget class="QListWidget" name="listWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand All @@ -28,6 +31,12 @@
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
Expand Down Expand Up @@ -55,13 +64,38 @@
</widget>
</item>
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<widget class="QScrollArea" name="scrollArea">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>464</width>
<height>204</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
Expand Down

0 comments on commit 8dcc723

Please sign in to comment.