void QtDesignerChild::setFileBuffer( const QString& content ) { createNewForm(); mHostWidget->formWindow()->setFileName( filePath() ); mHostWidget->formWindow()->setContents( content ); mHostWidget->formWindow()->setDirty( true ); formChanged(); QTimer::singleShot( 500, this, SLOT( formFileBufferChanged() ) ); }
QtDesignerChild::QtDesignerChild( QtDesignerManager* manager ) : pAbstractChild() { Q_ASSERT( manager ); mDesignerManager = manager; mHostWidget = 0; setWindowIcon( pIconManager::icon( "designer.png", ":/icons" ) ); createNewForm(); }
bool QtDesignerChild::openFile( const QString& fileName, const QString& codec ) { Q_UNUSED( codec ); if ( QFile::exists( fileName ) ) { // set content QFile file( fileName ); if ( !file.open( QIODevice::ReadOnly ) ) { return false; } createNewForm(); setFilePath( fileName ); mHostWidget->formWindow()->setFileName( fileName ); mHostWidget->formWindow()->setContents( &file ); if ( mHostWidget->formWindow()->mainContainer() ) { // set clean mHostWidget->formWindow()->setDirty( false ); setWindowModified( false ); emit fileOpened(); return true; } else { setFilePath( QString::null ); mHostWidget->formWindow()->setFileName( QString::null ); } } return false; }
void QtDesignerChild::closeFile() { createNewForm(); setFilePath( QString::null ); emit fileClosed(); }
void newForm::on_buttonBox_clicked(QAbstractButton *button) // обработка нажатия кнопок { if (ui->buttonBox->standardButton(button) == QDialogButtonBox::Ok){ // кнопка Ок emit createNewForm(ui->spinBox->value(), ui->spinBox_2->value(), ui->lineEdit->text()); } }