-
UID:102345
-
- 注册时间2010-08-01
- 最后登录2010-09-28
- 在线时间0小时
-
- 发帖10
- 搜Ta的帖子
- 精华0
- 金钱100
- 威望20
- 贡献值0
- 好评度10
-
访问TA的空间加好友用道具
|
如题, 头文件我找到了,在dqt目录下的include下,也加到Makefile了,后来 编译后还是这个头文件里面用到的头文件出问题了(而且错误更多了,下面附图)。我是用qt designer做的 对话框,主 窗口就一个 按钮,请问怎么在点击按钮后弹出这个对话框???谢谢。。。这个程序是准备移植到板子上的,555555弄了一个晚上都没结果。。。 - 这是disigner做的dialog的cpp文件,图片代码省略了
- #include "opendialog.h"
- #include <qiconview.h>
- #include <qpushbutton.h>
- #include <qlayout.h>
- #include <qvariant.h>
- #include <qtooltip.h>
- #include <qwhatsthis.h>
- #include <qimage.h>
- #include <qpixmap.h>
- MyDialog::MyDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
- : QDialog( parent, name, modal, fl )
- {
- QPixmap image0( ( const char** ) image0_data );
- if ( !name )
- setName( "MyDialog" );
- resize( 515, 286 );
- setCaption( tr( "MyDialog" ) );
- setSizeGripEnabled( TRUE );
- QWidget* privateLayoutWidget = new QWidget( this, "Layout1" );
- privateLayoutWidget->setGeometry( QRect( 20, 230, 476, 33 ) );
- Layout1 = new QHBoxLayout( privateLayoutWidget );
- Layout1->setSpacing( 6 );
- Layout1->setMargin( 0 );
- buttonHelp = new QPushButton( privateLayoutWidget, "buttonHelp" );
- buttonHelp->setText( tr( "&Help" ) );
- buttonHelp->setAutoDefault( TRUE );
- Layout1->addWidget( buttonHelp );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- Layout1->addItem( spacer );
- buttonApply = new QPushButton( privateLayoutWidget, "buttonApply" );
- buttonApply->setText( tr( "&Apply" ) );
- buttonApply->setAutoDefault( TRUE );
- Layout1->addWidget( buttonApply );
- buttonOk = new QPushButton( privateLayoutWidget, "buttonOk" );
- buttonOk->setText( tr( "&OK" ) );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- Layout1->addWidget( buttonOk );
- buttonCancel = new QPushButton( privateLayoutWidget, "buttonCancel" );
- buttonCancel->setText( tr( "&Cancel" ) );
- buttonCancel->setAutoDefault( TRUE );
- Layout1->addWidget( buttonCancel );
- IconView3 = new QIconView( this, "IconView3" );
- (void) new QIconViewItem( IconView3, tr( "test.db" ), image0 );
- IconView3->setGeometry( QRect( 30, 10, 441, 201 ) );
- // signals and slots connections
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
- connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( helpme() ) );
- connect( buttonApply, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( IconView3, SIGNAL( doubleClicked(QIconViewItem*) ), this, SLOT( openfile() ) );
- }
- /*
- * Destroys the object and frees any allocated resources
- */
- MyDialog::~MyDialog()
- {
- // no need to delete child widgets, Qt does it all for us
- }
- void MyDialog::helpme()
- {
- qWarning( "MyDialog::helpme(): Not implemented yet!" );
- }
- void MyDialog::selected()
- {
- qWarning( "MyDialog::selected(): Not implemented yet!" );
- }
- void MyDialog::openfile()
- {
- qWarning( "MyDialog::openfile(): Not implemented yet!" );
- }
- //这是只有一个按钮的主窗口cpp
- #include "previewbutton.h"
- #include "opendialog.h"
- #include "/opt/EmbedSky/Qte/x86-qtopia-2.2.0/dqt/include/qwidgetfactory.h"
- #include <qpushbutton.h>
- #include <qlayout.h>
- #include <qvariant.h>
- #include <qtooltip.h>
- #include <qwhatsthis.h>
- #include <qstring.h>
- #include <qfiledialog.h>
- //#include <qwidgetfactory.h>
- /*
- * Constructs a Form1 which is a child of 'parent', with the
- * name 'name' and widget flags set to 'f'
- */
- Form1::Form1( QWidget* parent, const char* name, WFlags fl )
- : QWidget( parent, name, fl )
- {
- if ( !name )
- setName( "Form1" );
- resize( 596, 480 );
- setCaption( tr( "Form1" ) );
- open_file = new QPushButton( this, "open_file" );
- open_file->setGeometry( QRect( 310, 10, 91, 41 ) );
- open_file->setText( tr( "Openfile" ) );
- // signals and slots connections
- connect( open_file, SIGNAL( clicked() ), this, SLOT( tofile() ) );
- }
- /*
- * Destroys the object and frees any allocated resources
- */
- Form1::~Form1()
- {
- // no need to delete child widgets, Qt does it all for us
- }
- void Form1::tofile()
- {
- // qWarning( "Form1::tofile(): Not implemented yet!" );
- MyDialog* openfiledia = ( MyDialog* ) QWidgetFactory::create( "opendialog.ui" );
- openfiledia->exec();
- }
谢谢大虾们了,我是初学的,很多不懂。。。
|