Popup Colour Menu in Qt - qt

In Qt, what's the best way to do a popup colour picker menu like this:

Qt doesn't have a QWidget class for this. You will need to write your own. Or use an existing one, like QColorPicker from QtSolutions.

Related

QMainWindow Titlebar Style Change

I am beginner and just began learning Qt.
When I created a new project, it has mainwindow.ui, mainwindow.cpp, mainwindow.h, and main.cpp.
I want to change color of title bar of mainwindow, but i can't find title bar in design mode.
How to get this done?
Thank you.
You can do it via QWidget with SIGNALS and SLOTS.
Here example how to do it: https://evileg.com/en/post/156/

how to get a "lightbox" like behaviour in Qt

I have a Qt project where I'm using QGraphicsView framework, also I have popup windows on the scenes. (QDialogs)
When someone clicks on a certain button a popup window appears, and I'm invoking it with the .exec() method instead of .show() to make it the active one. Also I want to give it a visual effect like lightbox provides for html pages, so it would be obvious for the user too, that the background window won't communicate. Do you know any simple solution to make it work? or is it hard to implement in Qt?
EDIT: I don't know if it's obvious of not, but it's a desktop application, not a web application.
Just create QFrame over necessary area with customized background and transparency. For animation effect you may use QPropertyAnimation + QGraphicEffects and other stuff from qt animation framework.
Now I found another way to accomplish what I wanted. Like this:
QWidget* mytranswidget = new QWidget(mybgwidget);
mytranswidget->setStyleSheet( "background:transparent; background-color:rgba(0,0,0‌​,95)");
mytranswidget->setWindowFlag(Qt::FramelessWindowHint);
mytranswidget->setGeometry(mybgwidget->rect());
mytranswidget->show();
I'm doing it at the beginning of my popup widget's constructor so it's being drawn before draw my popup, so it will be shown in the right order.

is it possible to put a customize gtkwidget in a gtktreeview?

I'm learning GTK+ in this moment (after Qt) just to know what is possible with it thus Qt is for digia. Put a custom widget in a QListWidget is possible so I want to know if it is possible to do something like that using GTK+. An example of this widget could be one pixmap, one label and one button all in the same Cell and layout with a container like Gtktable.
Thanks
Yes, of course. You just need a "custom cell renderer":
http://scentric.net/tutorial/ch-treeview.html
http://gtk.php.net/manual/en/html/tutorials/tutorials.treeview.view.html

Need help on basic Qt structure

Hi I am a Qt beginner. I want to make something like a column of icons on the left, after click the icons different forms and results appear on the right, how can I do this? Should I choose QMainWindow or QWidget for this project?
should I choose mainwindow or widget for this
project?
If what you described are the only things present in the window, you should use a QMainWindow. If you think you will want to re-use this arrangement in the future, I'd use a QWidget. It will probably be easier to implement each set of forms as a separate QWidget (in Designer; if you're building the GUI programmatically, just add the forms to a QLayout in a QFrame).
a column of icons on the left, after click the icons different
forms and results appear on the right
For the column of icons, you should look at QListWidget. It provides a vertical list of QListWidgetItems, and the items can contain icons, and nothing else. Your main window can then connect to the list widget's currentItemChanged signal (or itemChanged or something else; there are several choices), and modify the forms in the right-hand side of the window appropriately.

QT and custom menu item (QLineEdit)

How can I use QLineEdit as a menu item in QMenu? Is there any solutions to do this?
Just to do something like this (look at the edit box under the avatar):
You can use a QWidgetAction to contain your QLineEdit. It inherits QAction.
Take a look at QComboBox. It allows editing of items in a pop-up menu. But if you mean the menu in the main menu bar, I don't think there's a way to do it. And it's not a good UI anyway.

Resources