[Qt-interest] QComboBox item size for touch screen

Wagner Sales wsales at gmail.com
Sat May 16 23:45:47 CEST 2009


Hi all,

I'm implementing a touch screen interface that's needs a better size
of the items, but currently I cannot set the item size for a better
user experience.
I tryed:

Approach one: by styling combo box:
QComboBox QListView::item {
	border-style: outset;
	border-size: 1px;
	border-color: gray;
    min-height: 36px;
}

or

QComboBox QAbstractItemView::item {
	border-style: outset;
	border-size: 1px;
	border-color: gray;
    min-height: 36px;
}
Results: no works.

Approach two: styling in code:
QListView *l = qobject_cast<QListView*>(Combo->view());
if(l)
{
            QString css = "QListView::item"
            "{"
            "	border-color: gray;"
            "   min-height: 48px;"
            "}";
            l->setStyleSheet(css);

}
Results: no works.

Approach three: by changing QApplication::globalStrut()
QApplication app(argc, argv);
app.setGlobalStrut(QSize(36,36));
Results: no works.

And finally by setting spacing in QListView from QComboBox::view().
The results are uggly, since I do selection effects on the items.
Are some workaround to solve this? This behavior ( at least changing
by style sheet) was not to be expected?

Regards,

Wagner Sales



More information about the Qt-interest-old mailing list