//! [5] int main(int argc, char *argv[]) { QApplication app(argc, argv); QTableWidget tableWidget(4, 4); tableWidget.setItemDelegate(new StarDelegate); tableWidget.setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::SelectedClicked); tableWidget.setSelectionBehavior(QAbstractItemView::SelectRows); QStringList headerLabels; headerLabels << "Title" << "Genre" << "Artist" << "Rating"; tableWidget.setHorizontalHeaderLabels(headerLabels); populateTableWidget(&tableWidget); tableWidget.resizeColumnsToContents(); tableWidget.resize(500, 300); #if defined(Q_OS_SYMBIAN) tableWidget.showMaximized(); #else tableWidget.show(); #endif return app.exec(); }
void ImageSyncApp::currentTabChanged( int currentTabIndex ) { if( currentTabIndex == 0 ) { // we are on the process page, so copy all the relevant fields // into the coinfigurationFile populateConfigurationFormGui(); populateTableWidget(); } }
void ImageSyncApp::initializeMainWindow() { configurationFile_ = boost::shared_ptr< ConfigurationFile > ( new ConfigurationFile( CONFIGURATION_FILE ) ); readerThread_.reset( new ReaderThread( incommingJobs_, outgoingJobs_ ) ); writerThread_.reset( new WriterThread( outgoingJobs_ ) ); mainWindowContent_->setupUi( mainWindow_.get() ); mainWindow_->setWindowTitle( "imageSync - E.B." ); mainWindowContent_->downloadProgress->setMinimum( 0 ); mainWindowContent_->downloadProgress->setMaximum( 0 ); mainWindowContent_->downloadProgress->setValue( 0 ); mainWindowContent_->buttonCancel->setEnabled( false ); mainWindow_->show(); new QShortcut( Qt::CTRL + Qt::Key_Q, mainWindow_.get(), SLOT( close() ) ); QObject::connect( mainWindowContent_->buttonCancel, SIGNAL( clicked() ), this, SLOT( cancelRequested() ) ); QObject::connect( mainWindowContent_->buttonGo, SIGNAL( clicked() ), this, SLOT( startConversion() ) ); QObject::connect( mainWindowContent_->buttonBrowseSource, SIGNAL( clicked() ), this, SLOT( browseSource() ) ); QObject::connect( mainWindowContent_->buttonBrowseDestination, SIGNAL( clicked() ), this, SLOT( browseDestination() ) ); QObject::connect( mainWindowContent_->tabWidget, SIGNAL( currentChanged( int ) ), this, SLOT( currentTabChanged( int ) ) ); QObject::connect( mainWindow_.get(), SIGNAL( closeRequested() ), this, SLOT( mainWindowCloseRequested() ) ); QObject::connect( readerThread_.get(), SIGNAL( reportOperation( QString ) ), mainWindowContent_->statusLine, SLOT( setText( QString ) ) ); QObject::connect( readerThread_.get(), SIGNAL( reportSpeed( QString ) ), mainWindowContent_->speedLine, SLOT( setText( QString ) ) ); QObject::connect( writerThread_.get(), SIGNAL( oneJobFinished() ), this, SLOT( writerFinishedOneJob() ) ); populateGuiFromConfiguration(); populateTableWidget(); readerThread_->start(); writerThread_->start(); }