I did NOT use qt designer to design the ui,I just use code to generate the myprog.cpp and myprog.h and main.cpp,
This is the important point.
quote:
NOW I wanna add init() function to make initailize some variations on running,so I generate another file called myprog.ui.h and put the follow code into it:
Whatever name you give your file, it's not important. The problem is elsewhere. Your method and declaration is fine too.
quote:
Then I compile the program and run it. THE textlabel did NOT display anything!!WHY?
Designer manual states that init() method is automatically called if present. Yes, right, but only for designer generated UI and NOT for hand generated ones.
What uic does looks like the following(edit: comments added to explain uic job):
code:
MyClass::MyClass( QObject * parent, const char * name )
: QWidget( parent, name )
{
if ( !name )
setName( "MyClass" ) ;
// Some or huge widget building stuff
// Calls the protected method for internationalization.
// LanguageChange contains all the needed tr() for all widgets.
languageChange() ;
// Final size management.
resize( QSize(303, 530).expandedTo(minimumSizeHint()) );
// Sets correct state
clearWState( WState_Polished );
// Often a huge connect list
connect( resetBtn, SIGNAL( clicked() ), this, SLOT( resetData() ) );
// Maybe some tab ordering if needed.
setTabOrder( abridged, cname );
// And now, ladies and gentlemen, just before
// finishing the constructor....
init() ;
}
When you code the hard way, the compiler cannot rely on uic to generate this kind of constructor. So you have to insert init() call in your constructor by yourself, after standard constructor methods.
分享到:
相关推荐
GUI开发示例代码---QTdesigner实现自定义槽函数
Qt Designer是PyQt程序UI界面的实现工具,Qt Designer工具使用简单,可以通过拖拽和点击完成复杂界面设计,并且设计完成的.ui程序可以转换成.py文件供python程序调用。本文主要通过用户登录需求描述Qt Designer工具...
pythonqt5教程从零开始_pyQt5QtDesigner简易⼊门教程 python3.6 & pyQt5 & QtDesigner 简易⼊门教程 1. python 官⽹下载安装python3.6并配置好环境; 2.cmd下 运⾏: pip install PyQt5 安装PyQt库; 3.cmd下运⾏: ...
To launch Qt Designer, click Qt 3.2.x|Qt Designer in the Start menu on Windows, type designer on the command line on Unix, or double-click designer in the Mac OS X Finder. When Qt Designer starts, it ...
Qt Designer Setup.exe工具包。 PyQt5 图形界面-用Qt Designer来设计UI界面,并转化为python代码运行实例演示:https://blog.csdn.net/qq_38161040/article/details/85245112
简体中文语言包:designer_zh_CN.qm。 Qt Designer使用简体中文语言包方法演示请看:https://lanzao.blog.csdn.net/article/details/119065057
Qt4下的自定义Button控件源码,将生成的.so控件库,拷贝到QtDesigner目录下,在QtDesignerIDE开发环境中就可以看到Button控件
Qtdesigner5.2Qtdesigner5.2Qtdesigner5.2Qtdesigner5.2Qtdesigner5.2Qtdesigner5.2Qtdesigner5.2Qtdesigner5.2Qtdesigner5.2Qtdesigner5.2Qtdesigner5.2Qtdesigner5.2Qtdesigner5.2Qtdesigner5.2Qtdesigner5.2Qt...
Qt Designer汉化包,亲测可用,福利你懂的,内含安装步骤,pyqt5版本
QtDesigner的ui案例,涉及到弹窗,下载进度图等,不涉及具体的py或者cpp代码
使用Qt5.6绘制sin函数波形,可调节周期与振幅。对于初学者绘制波形十分有用。
QT是一款块平台的桌面开发工具,而且还可以使用做其他语言,处理C++还可使用在Python中,但是会使用的pyqt包。Qt Designer 是对界面可视化设计的必要工具。
版本:Qt 5.12,官方下载的安装包,注意是在线安装的。
Qt Designer Setup.exe 是windows的软件,用来设计软件的页面布局的工具,从官网下载很慢,下载完放在这里供大家快速下载,多多支持!!
2 使用Qt Designer设计并实现第一个页面 - 登陆.zip
pyqt5对用qt designer设计的窗体实现弹出子窗口,里面包含3个文件mainWindow.py,childWindow.py,action.py,经测试可以跑通
该代码实现了将新自定义的控件集成到Qt Designer中,以后可以像使用QPushButton一样非常方便的使用该控件,并附有使用说明。
Qt Designer Setup.exe(qt界面设计器)
Qt Designer is a tool for quickly building graphical user interfaces with widgets from the Qt GUI framework. It gives you a simple drag-and-drop interface for laying out components such as buttons, ...
Qt Designer 的插件的编写的源代码说明在我的博客里