2
* Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 2 or (at your option)
7
* version 3 of the License.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
#include "WindowSelectComboBox.h"
22
#include "autotype/AutoType.h"
24
WindowSelectComboBox::WindowSelectComboBox(QWidget* parent)
28
setInsertPolicy(QComboBox::NoInsert);
29
setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed, QSizePolicy::ComboBox));
31
// first item is always the current content of the line edit
35
void WindowSelectComboBox::refreshWindowList()
37
model()->setData(model()->index(0, 0), lineEdit()->text());
42
insertItems(1, autoType()->windowTitles());
45
void WindowSelectComboBox::showPopup()
47
if (lineEdit()->isReadOnly()) {
53
QComboBox::showPopup();
56
QSize WindowSelectComboBox::sizeHint() const
58
QSize size = lineEdit()->sizeHint();
59
size.setHeight(qMax(size.height(), QComboBox::sizeHint().height()));
63
QSize WindowSelectComboBox::minimumSizeHint() const
65
QSize size = lineEdit()->minimumSizeHint();
66
size.setHeight(qMax(size.height(), QComboBox::minimumSizeHint().height()));