Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // main.h
- #pragma once
- #include <QtCore>
- #include <QtGui>
- class WndTable : public QDialog
- {
- Q_OBJECT
- public: WndTable( QWidget* parent = 0 ) :
- QDialog( parent )
- {
- QVBoxLayout* layout = new QVBoxLayout( this );
- QTableWidget* table = new QTableWidget( this );
- layout->addWidget( table );
- setAttribute( Qt::WA_DeleteOnClose );
- table->setColumnCount( 1 );
- table->setRowCount( 128 * 1024 );
- for( int i = 0; i < 128 * 1024; i ++ )
- {
- QTableWidgetItem* item = new QTableWidgetItem( tr( "%1" ).arg( i ) );
- table->setItem( i, 0, item );
- }
- }
- };
- class WndMain : public QPushButton
- {
- Q_OBJECT
- public: WndMain( QWidget* parent = 0 ) :
- QPushButton( parent )
- {
- connect( this, SIGNAL(clicked()), this, SLOT(OnClick()) );
- }
- private slots: void OnClick()
- {
- (new WndTable( this ))->show();
- }
- };
- // main.cpp
- #include "main.h"
- int main( int argc, char** argv )
- {
- QApplication app( argc, argv );
- WndMain wndMain;
- wndMain.setText( "Click me" );
- wndMain.show();
- return app.exec();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement