⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 diapage.cpp

📁 基于QT的报表工具
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    lblDataSrc = new QLabel( pageDataSource, "lblDataSrc" );	layDSTop->addWidget( lblDataSrc );    comboDataSource = new QComboBox( FALSE, pageDataSource, "comboDataSource" );    comboDataSource->setMaximumSize( QSize( 170, 32767 ) );	layDSTop->addWidget( comboDataSource );	layDSTop->addStretch( 5 );	gbCon = new QGroupBox( pageDataSource, "gbCon" );    gbCon->setColumnLayout(0, Qt::Vertical );    gbCon->layout()->setSpacing( 6 );    gbCon->layout()->setMargin( 6 );    gbConLayout = new QGridLayout( gbCon->layout(), 0, 0, 3 );    gbConLayout->setAlignment( Qt::AlignTop );    lblHot = new QLabel( gbCon, "lblHot" );    gbConLayout->addWidget( lblHot, 0, 0 );    leHost = new QLineEdit( gbCon, "leHost" );    gbConLayout->addWidget( leHost, 0, 1 );    lblDB = new QLabel( gbCon, "lblDB" );    gbConLayout->addWidget( lblDB, 1, 0 );    leDB = new QLineEdit( gbCon, "leDB" );    gbConLayout->addWidget( leDB, 1, 1 );    lblUser = new QLabel( gbCon, "lblUser" );    gbConLayout->addWidget( lblUser, 2, 0 );    leUSer = new QLineEdit( gbCon, "leUSer" );    gbConLayout->addWidget( leUSer, 2, 1 );    lblPassword = new QLabel( gbCon, "lblPassword" );    gbConLayout->addWidget( lblPassword, 3, 0 );	lePassw = new QLineEdit( gbCon, "lePassw" );    lePassw->setEchoMode( QLineEdit::Password );    gbConLayout->addWidget( lePassw, 3, 1 );		layPageDataSource->addWidget( gbCon );	// TEXT Source	gbText = new QGroupBox( pageDataSource, "gbText" );    gbText->setColumnLayout(0, Qt::Vertical );    gbText->layout()->setSpacing( 6 );    gbText->layout()->setMargin( 6 );    gbTextLayout = new QGridLayout( gbText->layout(), 0, 0, 3 );    gbTextLayout->setAlignment( Qt::AlignTop );	lblResrcText = new QLabel( gbText, "lblResrcText" );    gbTextLayout->addWidget( lblResrcText, 0, 0 );	leResourceText = new QLineEdit( gbText, "leResourceText" );    gbTextLayout->addWidget( leResourceText, 0, 1 );	lblTextDataDelim = new QLabel( gbText, "lblTextDataDelim" );    gbTextLayout->addWidget( lblTextDataDelim, 1, 0 );	comboDelimiter = new QComboBox( FALSE, gbText, "comboDelimiter" );    comboDelimiter->setMaximumSize( QSize( 140, 32767 ) );    gbTextLayout->addWidget( comboDelimiter, 1, 1 );	lblRowFilter = new QLabel( gbText, "lblRowFilter" );	gbTextLayout->addWidget( lblRowFilter, 2, 0 );	leRowFilter = new QLineEdit( gbText, "leRowFilter" );	gbTextLayout->addWidget( leRowFilter, 2, 1 );		layPageDataSource->addWidget( gbText );	//-----------------------------------		diaPageLayout->addLayout( layLeft );	tab->addTab( pagePage, tr("General") );	tab->addTab( pageDataSource, tr("Datasource") );    layBtn = new QVBoxLayout( 0, 0, 6, "layBtn");     btnOK = new QPushButton( this, "btnOK" );    layBtn->addWidget( btnOK );    btnCancel = new QPushButton( this, "btnCancel" );    layBtn->addWidget( btnCancel );    spBtn = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding );    layBtn->addItem( spBtn );    diaPageLayout->addLayout( layBtn );    languageChange();    //resize( QSize(512, 458).expandedTo(minimumSizeHint()) );	resize( minimumSizeHint() );    clearWState( WState_Polished );    // signals and slots connections    connect( btnOK, SIGNAL( clicked() ), this, SLOT( accept() ) );    connect( btnCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );    // tab order    setTabOrder( leName, comboEncodings );    setTabOrder( comboEncodings, comboPageSize );    setTabOrder( comboPageSize, comboPrinterMode );    setTabOrder( comboPrinterMode, leFont );    setTabOrder( leFont, spFontSize );    setTabOrder( spFontSize, leMasterAlias );    setTabOrder( leMasterAlias, spTop );    setTabOrder( spTop, spLeft );    setTabOrder( spLeft, spRight );    setTabOrder( spRight, spBottom );    setTabOrder( spBottom, radioP );    setTabOrder( radioP, radioL );    setTabOrder( radioL, leHost );    setTabOrder( leHost, leDB );    setTabOrder( leDB, leUSer );    setTabOrder( leUSer, lePassw );    setTabOrder( lePassw, btnOK );    setTabOrder( btnOK, btnCancel );		initComboBoxes();		leHost->setEnabled(FALSE);	leDB->setEnabled(FALSE);	leUSer->setEnabled(FALSE);	lePassw->setEnabled(FALSE);}/* *  Destroys the object and frees any allocated resources */diaPage::~diaPage(){    // no need to delete child widgets, Qt does it all for us}/* *  Sets the strings of the subwidgets using the current *  language. */void diaPage::languageChange(){    setCaption( tr( "Report settings" ) );    gbGen->setTitle( tr( "General settings" ) );    lblEncode->setText( tr( "File encoding" ) );    lblPrintMode->setText( tr( "Printer mode" ) );    textLabel10->setText( tr( "Primary query alias" ) );    lblFont->setText( tr( "Default font name" ) );    lblPageSize->setText( tr( "Page size" ) );    lblFonstSize->setText( tr( "Default font size" ) );    lblName->setText( tr( "Report name" ) );    gbMargin->setTitle( tr( "Margins" ) );    lblLeft->setText( tr( "Left" ) );    lblBottom->setText( tr( "Bottom" ) );    lblTop->setText( tr( "Top" ) );    lblRight->setText( tr( "Right" ) );    gbOrient->setTitle( tr( "Orientation" ) );    radioP->setText( tr( "Portrait" ) );    radioL->setText( tr( "Landscape" ) );    gbCon->setTitle( tr( "Database connection" ) );    lblHot->setText( tr( "Host" ) );    lblDB->setText( tr( "Database" ) );    lblUser->setText( tr( "Username" ) );    lblPassword->setText( tr( "Password" ) );    btnOK->setText( tr( "OK" ) );    btnCancel->setText( tr( "Cancel" ) );	gbText->setTitle( tr( "Textfile source settings" ) );	lblDataSrc->setText( tr("Datasource") );	lblResrcText->setText( tr("Resource text file") );	lblTextDataDelim->setText( tr("Field delimiter") );	lblRowFilter->setText( tr("Row filter regexp:") );}void diaPage::assignDocument( NCReportDesignerDocument *doc ){	document = doc;		leName->setText(doc->po.reportName);	comboEncodings->setCurrentText(doc->po.encoding);	comboPageSize->setCurrentText(doc->po.pageSize);	comboPrinterMode->setCurrentText(doc->po.printerMode);	leFont->setText(doc->po.defaultFontName);	spFontSize->setValue(doc->po.defaultFontSize);	leMasterAlias->setText(doc->po.masterAlias);	spTop->setValue(doc->po.topMargin);	spBottom->setValue(doc->po.bottomMargin);	spLeft->setValue(doc->po.leftMargin);	spRight->setValue(doc->po.rightMargin);	gbOrient->setButton( doc->po.orient == ReportPageOptions::Portrait ? 0 : 1 );	comboDataSource->setCurrentItem( doc->po.dataSource == ReportPageOptions::Database ? 0 : 1 );	leResourceText->setText(doc->po.resourceTextFile);	comboDelimiter->setCurrentText(doc->po.textDataDelimiter);	leRowFilter->setText( doc->po.rowFilterRegExp );}void diaPage::applySettings( ){	document->po.reportName = leName->text();	document->po.encoding = comboEncodings->currentText();	document->po.pageSize = comboPageSize->currentText();	document->po.printerMode = comboPrinterMode->currentText();	document->po.defaultFontName = leFont->text();	document->po.defaultFontSize = spFontSize->value();	document->po.masterAlias = leMasterAlias->text();	document->po.topMargin = spTop->value();	document->po.bottomMargin = spBottom->value();	document->po.leftMargin = spLeft->value();	document->po.rightMargin = spRight->value();	document->po.orient = ( gbOrient->selectedId() == 0 ? ReportPageOptions::Portrait : ReportPageOptions::Landscape );	//document->po.columnCount = 1;	//document->po.backColor = "#FFFFFF";	//document->po.pageHeight	//document->po.pageWidth	document->po.dataSource = ( comboDataSource->currentItem()==0 ? ReportPageOptions::Database : ReportPageOptions::Textfile );	document->po.resourceTextFile = leResourceText->text();	document->po.textDataDelimiter = comboDelimiter->currentText();	document->po.rowFilterRegExp = leRowFilter->text();	document->setPageSize();}void diaPage::initComboBoxes( ){	int i=0;	while ( _localenames[i] ) {		comboEncodings->insertItem( _localenames[i] );		++i;	}	i=0;	while ( _pagesizes[i] ) {		comboPageSize->insertItem( _pagesizes[i] );		++i;	}	i=0;	while ( _printermodes[i] ) {		comboPrinterMode->insertItem( _printermodes[i] );		++i;	}	i=0;	while ( _datasources[i] ) {		comboDataSource->insertItem( _datasources[i] );		++i;	}	i=0;	while ( _txtdelimiters[i] ) {		comboDelimiter->insertItem( _txtdelimiters[i] );		++i;	}			}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -