qt3

Adding custom widgets to QMenuBar

﹥>﹥吖頭↗ 提交于 2019-12-10 09:24:49
问题 Qt3 used to provide QMenuBar::insertItem with QWidget* parameter. This way any custom widget could be added to menu bar - for example a clock-widget. In Qt4 there is no such overloaded method. What would be the best way to reach the same goal - adding custom widgets to a menu bar? The custom widgets should be integrated in the layout of menu bar. Does anyoune knows the background, why this overload of insertItem was removed in Qt4 API? Best regards. 回答1: there's a QMenuBar::addAction (

Adding custom widgets to QMenuBar

筅森魡賤 提交于 2019-12-05 12:30:25
Qt3 used to provide QMenuBar::insertItem with QWidget* parameter. This way any custom widget could be added to menu bar - for example a clock-widget. In Qt4 there is no such overloaded method. What would be the best way to reach the same goal - adding custom widgets to a menu bar? The custom widgets should be integrated in the layout of menu bar. Does anyoune knows the background, why this overload of insertItem was removed in Qt4 API? Best regards. there's a QMenuBar::addAction ( QAction * action ) method, to add an arbitrary QAction to the menu bar. For example, it could be a QWidgetAction ,

Generate .h and .cpp from .ui file

左心房为你撑大大i 提交于 2019-11-30 05:12:29
Suppose I have the file about.ui . How can I make the "about.h" and the "about.cpp" from my .ui file? I have to create a .moc file too? How can I compile this after the creaton to see if all ocurred correctly? If automatic generation does not work (like in my case) you can use uic to generate the header file manually. uic file.ui > file.h You don't. The about.ui generates a ui_about.h which you include in your own about.h You then create you own class deriving from this class class about : public QDialog, public Ui::about { Q_OBJECT; .... } Short answer: In QtCreator there are two ways of

Generate .h and .cpp from .ui file

跟風遠走 提交于 2019-11-29 03:05:18
问题 Suppose I have the file about.ui . How can I make the "about.h" and the "about.cpp" from my .ui file? I have to create a .moc file too? How can I compile this after the creaton to see if all ocurred correctly? 回答1: If automatic generation does not work (like in my case) you can use uic to generate the header file manually. uic file.ui > file.h 回答2: You don't. The about.ui generates a ui_about.h which you include in your own about.h You then create you own class deriving from this class class