Set parent object for advancedsettings

Remove borders
Resize column size correctly
This commit is contained in:
Chocobo1 2015-11-15 14:08:22 +08:00
parent 29c94d2fb5
commit a8b394752e
4 changed files with 28 additions and 59 deletions

View file

@ -72,21 +72,22 @@ enum AdvSettingsRows
AdvancedSettings::AdvancedSettings(QWidget *parent)
: QTableWidget(parent)
{
// Set visual appearance
setEditTriggers(QAbstractItemView::NoEditTriggers);
setAlternatingRowColors(true);
// column
setColumnCount(2);
QStringList header;
header << tr("Setting") << tr("Value", "Value set for this setting");
QStringList header = { tr("Setting"), tr("Value", "Value set for this setting") };
setHorizontalHeaderLabels(header);
setColumnWidth(0, width() / 2);
horizontalHeader()->setStretchLastSection(true);
verticalHeader()->setVisible(false);
// row
setRowCount(ROW_COUNT);
verticalHeader()->setVisible(false);
// etc.
setAlternatingRowColors(true);
setEditTriggers(QAbstractItemView::NoEditTriggers);
// Signals
connect(&spin_cache, SIGNAL(valueChanged(int)), SLOT(updateCacheSpinSuffix(int)));
// Load settings
loadAdvancedSettings();
resizeColumnToContents(0);
horizontalHeader()->setStretchLastSection(true);
}
void AdvancedSettings::saveAdvancedSettings()

View file

@ -41,7 +41,7 @@ class AdvancedSettings: public QTableWidget
Q_OBJECT
public:
AdvancedSettings(QWidget *parent = 0);
AdvancedSettings(QWidget *parent);
public slots:
void saveAdvancedSettings();

View file

@ -162,8 +162,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>454</width>
<height>610</height>
<width>480</width>
<height>672</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_9">
@ -520,8 +520,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>454</width>
<height>942</height>
<width>487</width>
<height>1040</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@ -1033,8 +1033,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>361</width>
<height>586</height>
<width>450</width>
<height>658</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_20">
@ -1563,8 +1563,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>275</width>
<height>401</height>
<width>376</width>
<height>444</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
@ -1947,8 +1947,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>440</width>
<height>481</height>
<width>555</width>
<height>527</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
@ -2341,8 +2341,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>332</width>
<height>480</height>
<width>419</width>
<height>537</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_23">
@ -2707,47 +2707,19 @@
</layout>
</widget>
<widget class="QWidget" name="tabAdvancedPage">
<layout class="QVBoxLayout" name="verticalLayout_35">
<layout class="QVBoxLayout" name="advPageLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea_advanced">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_10">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>28</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_36">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>

View file

@ -279,10 +279,8 @@ options_imp::options_imp(QWidget *parent)
// Tab selection mechanism
connect(tabSelection, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
// Load Advanced settings
QVBoxLayout *adv_layout = new QVBoxLayout();
advancedSettings = new AdvancedSettings();
adv_layout->addWidget(advancedSettings);
scrollArea_advanced->setLayout(adv_layout);
advancedSettings = new AdvancedSettings(tabAdvancedPage);
advPageLayout->addWidget(advancedSettings);
connect(advancedSettings, SIGNAL(settingsChanged()), this, SLOT(enableApplyButton()));
// Adapt size
@ -312,8 +310,6 @@ options_imp::~options_imp()
foreach (const QString &path, addedScanDirs)
ScanFoldersModel::instance()->removePath(path);
ScanFoldersModel::instance()->configure(); // reloads "removed" paths
delete scrollArea_advanced->layout();
delete advancedSettings;
}
void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous)