How to always open QComboBox popup downwards? - c++

I'm using a stylesheet for my GUI elements such as the QComboBox and I need the popup to drop downwards which is not working at all. I'm working on a Linux based system. My Qt version is 5.4.2.
I already tried to set the style of the whole application with QApplication::setStyle("fusion") or QApplication::setStyle("cleanlooks") which apparently didn't seem to work.
The combobox looks like this:
As you can see the popup always covers the actual button but i need it to expand underneath.
I'd appreciate any help on this matter!
Thanks in advance,
Michael

Found out that it was a style issue. I had to start the application with the -style cleanlooks parameter.

Related

Set QTabWidget Order by text of tabs

I am trying to set tab order by tab text or tab name
ui.tabWidget->setTabOrder(//set order here by tab name like "helloTab","hiTab");
//I have tried this(I know it's dumb just trying)
ui.tabWidget->setTabOrder(ui.tabWidget->tabBar->findChild<QTab *>("tab_1"), ui.tabWidget->tabBar->findChild<QTab *>("tab_2"));
Till now no hope of getting this done. I am fairly new to qt.
Any Ideas or help would be helpful.
QTab is not defined in Qt. Use QWidget:
ui.tabWidget->setTabOrder(ui.tabWidget->tabBar->findChild<QWidget *>("tab_1"), ui.tabWidget->tabBar->findChild<QWidget *>("tab_2"));

Hide Page/Tab from QTWidget - QT 5.5

i need to hide tabs from a existing project in QT, i don't want to delete the code because i have to set parameters on that code, the Application relay on that too. Seems like QT hasn't built-in hide(); function, i tried to edit stylesheet to make it smaller, but doesn't work too, i've looked on the internet and seems like this is a known issue. Does somebody have some tricks to avoid this?
Only thing i was able to come up with is:
ui->TabObject->setEnabled(false);
basically i disable objects in the tab to make them not usable by the user, but this is not a good thing for the whole UI.
Maybe by calling QTabWidget::removeTab(index) - this removes the tab from the QTabWidget, but does not delete the tab's QWidget.

Add some text to a QToolBar

I am having trouble adding some text in a QToolBar. I can only add Actions. Also I have two actions with their rerspectives icons in my QToolBar but I want to separate them and I canĀ“t either.
My newbie approach was to add empty actions to simulate blank spaces between the icons. But the user can click on the blank spaces.
I am using the Design function of QT Creator. Some help would be really apreciated.
It looks like you can't do it from within Designer:
https://bugreports.qt.io/browse/QTBUG-1267
That's an oooold suggestion, too, with a low priority to boot, so it probably won't get fixed any time soon.
You can get your hands dirty and do it in code, however.

Actionbar home icon in ActionBarSherlock

I am working off of the Styled project for ABS. I would like to customize the home icon in the actionbar. However, nothing I do seems to have any effect. I have tried to set the logo in the Manifest, styles, and in MainActivity. Has anybody come across this?
Thank you,
Igor
This was answered in another post
Apparently you must do getSupportActionBar().setIcon(R.drawable.my_custom_drawable); in MainActivity. I get it, but it's cumbersome that it cannot be set in the Manifest...

Creating a listbox-like control in QT C++

I am a beginner at QT and I have been trying to port a GUI project over from raw Win32 to QT. Only problem is I cannot find the name for some controls in the QT framework such as the pictured one below.
I believe it is called a listbox in C# and C++ and I used some code to put the title bar up at the top containing "Update, Version, Size, Date". What would this translate to in QT? I have tried the tableview from QT but it only succeeds in making a Microsoft Excel type box with rows and columns, my goal is only to get vertical columns with a title at the top. Thank you!
That's not a ListBox control, that's a ListView control.
Not sure what Qt calls it, but since they prefix everything with a Q, I'd imagine it's QListView.
The ListView is like a super-duper ListBox that also has a column header attached to it when you set it to display in "Details" view.
QListBox was deprecated in Qt 4, and was replaced by QListView.
For the type of multi-column control pictured, QTreeWidget should work.