qtdesigner的init()函数
来源:互联网 发布:c语言或者符号 编辑:程序博客网 时间:2024/05/01 18:45
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.
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.
- qtdesigner的init()函数
- Qtdesigner打不开的解决方案
- cocos的init函数
- PyQt + QtDesigner的ui文件
- SurfaceFlinger的init函数分析
- 用QTDesigner编写Linux的图形界面程序
- 为类设计init函数的好处
- Go语言_init_go的init函数
- jQuery源码之init函数的分析
- 3. init函数和class_init函数的讲解
- 将QtDesigner的ui文件转成可执行的python代码
- Digger们使用QtDesigner设计ui时的原则
- QT学习笔记(三) QtDesigner的简单使用
- QTdesigner中并没有出现我自定义的控件
- PyQt5教程 - QtDesigner窗口设计工具的使用
- PyQt4 将QTDesigner的界面 在py中展示
- pyqt4原始例程--调用QtDesigner生成的子函数
- 在Qt中如何使用QtDesigner创建的UI文件
- 有没有在富士康工作的朋友?介绍一下情况,好吗?
- Web Office的一些不足(zt)
- 揭开正则表达式的神秘面纱
- 2007互联网技术发展预测(zt)
- 在线式Office
- qtdesigner的init()函数
- EJB原理之(二)--EJB之前的日子--纯SQL阶段
- EJB原理之(三)--事务容器的出现
- C#中用126smtp发送邮件.
- [转发]linux进程Prelink
- 类似于QQ的菜单
- 浅谈C#托管程序中的资源释放问题
- 时间自动走
- lsof 快速起步