equal
deleted
inserted
replaced
66 resize(550, 430); |
66 resize(550, 430); |
67 setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); |
67 setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); |
68 |
68 |
69 setStyleSheet("QPushButton { padding: 5px; margin-top: 10px; }"); |
69 setStyleSheet("QPushButton { padding: 5px; margin-top: 10px; }"); |
70 |
70 |
71 // Theme model, and a model for setting a filter |
71 // Theme model |
72 ThemeModel * themeModel = DataManager::instance().themeModel(); |
72 ThemeModel * themeModel = DataManager::instance().themeModel(); |
73 filterModel = new QSortFilterProxyModel(); |
73 filterModel = themeModel->withoutHidden(); |
74 filterModel->setSourceModel(themeModel); |
74 // Custom filter extension |
75 filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); |
75 filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); |
|
76 // Reset search field |
|
77 filterModel->setFilterFixedString(QString()); |
76 |
78 |
77 // Grid |
79 // Grid |
78 QGridLayout * dialogLayout = new QGridLayout(this); |
80 QGridLayout * dialogLayout = new QGridLayout(this); |
79 dialogLayout->setSpacing(0); |
81 dialogLayout->setSpacing(0); |
80 dialogLayout->setColumnStretch(1, 1); |
82 dialogLayout->setColumnStretch(1, 1); |
117 topLayout->addWidget(corner, 0, Qt::AlignBottom); |
119 topLayout->addWidget(corner, 0, Qt::AlignBottom); |
118 topLayout->addStretch(1); |
120 topLayout->addStretch(1); |
119 |
121 |
120 // Cancel button (closes dialog) |
122 // Cancel button (closes dialog) |
121 QPushButton * btnCancel = new QPushButton(tr("Cancel")); |
123 QPushButton * btnCancel = new QPushButton(tr("Cancel")); |
122 connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject())); |
124 connect(btnCancel, SIGNAL(clicked()), this, SLOT(onRejected())); |
123 |
125 |
124 // Select button |
126 // Select button |
125 QPushButton * btnSelect = new QPushButton(tr("Use selected theme")); |
127 QPushButton * btnSelect = new QPushButton(tr("Use selected theme")); |
126 btnSelect->setDefault(true); |
128 btnSelect->setDefault(true); |
127 connect(btnSelect, SIGNAL(clicked()), this, SLOT(onAccepted())); |
129 connect(btnSelect, SIGNAL(clicked()), this, SLOT(onAccepted())); |
166 void ThemePrompt::moveRight() |
168 void ThemePrompt::moveRight() |
167 { |
169 { |
168 list->moveRight(); |
170 list->moveRight(); |
169 } |
171 } |
170 |
172 |
|
173 void ThemePrompt::onRejected() |
|
174 { |
|
175 reject(); |
|
176 filterModel->setFilterFixedString(QString()); |
|
177 } |
|
178 |
171 void ThemePrompt::onAccepted() |
179 void ThemePrompt::onAccepted() |
172 { |
180 { |
173 themeChosen(list->currentIndex()); |
181 themeChosen(list->currentIndex()); |
|
182 filterModel->setFilterFixedString(QString()); |
174 } |
183 } |
175 |
184 |
176 // When a theme is selected |
185 // When a theme is selected |
177 void ThemePrompt::themeChosen(const QModelIndex & index) |
186 void ThemePrompt::themeChosen(const QModelIndex & index) |
178 { |
187 { |