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

📄 test_manage.cpp

📁 基于嵌入式QT和DBstar SQL关系数据库的应用软件
💻 CPP
📖 第 1 页 / 共 3 页
字号:
"....................","....................","...................."};/*  *  Constructs a test_Manage which is a child of 'parent', with the  *  name 'name' and widget flags set to 'f'  * *  The dialog will by default be modeless, unless you set 'modal' to *  TRUE to construct a modal dialog. */test_Manage::test_Manage( QWidget* parent,  const char* name, bool modal, WFlags fl )    : QDialog( parent, name, modal, fl ){    QPixmap image0 = ( ( const char** ) image0_data );    QPixmap image1 = ( ( const char** ) image1_data );    image2 = new QPixmap( ( const char** ) image2_data );    image3 = new QPixmap( ( const char** ) image3_data );    image4 = new QPixmap( ( const char** ) image4_data );    image5 = new QPixmap( ( const char** ) image5_data );    if ( !name )	setName( "test_Manage" );    resize( 312, 220 );     setMaximumSize( QSize( 320, 220 ) );    setCaption( tr( "test_Manage" ) );    findFrame = new QFrame( this, "findFrame" );    findFrame->setGeometry( QRect( 120, 30, 200, 21 ) );     findFrame->setFrameShape( QFrame::Box );    findFrame->setFrameShadow( QFrame::Raised );    delButton = new QToolButton( findFrame, "delButton" );    delButton->setGeometry( QRect( 2, 2, 25, 17 ) );     delButton->setText( tr( "" ) );    delButton->setPixmap( image0 );    fineButton = new QToolButton( findFrame, "fineButton" );    fineButton->setGeometry( QRect( 170, 2, 25, 17 ) );     fineButton->setText( tr( "" ) );    fineButton->setPixmap( image1 );    find = new QLabel( findFrame, "find" );    find->setGeometry( QRect( 30, 2, 50, 17 ) );     find->setText( "Append:" );    find->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );    fineEdit = new QLineEdit( findFrame, "fineEdit" );    fineEdit->setGeometry( QRect( 80, 2, 87, 17 ) );     QPalette pal;    QColorGroup cg;    cg.setColor( QColorGroup::Foreground, black );    cg.setColor( QColorGroup::Button, QColor( 192, 192, 192) );    cg.setColor( QColorGroup::Light, white );    cg.setColor( QColorGroup::Midlight, QColor( 223, 223, 223) );    cg.setColor( QColorGroup::Dark, QColor( 96, 96, 96) );    cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) );    cg.setColor( QColorGroup::Text, black );    cg.setColor( QColorGroup::BrightText, white );    cg.setColor( QColorGroup::ButtonText, black );    cg.setColor( QColorGroup::Base, white );    cg.setColor( QColorGroup::Background, QColor( 192, 192, 192) );    cg.setColor( QColorGroup::Shadow, black );    cg.setColor( QColorGroup::Highlight, black );    cg.setColor( QColorGroup::HighlightedText, white );    pal.setActive( cg );    cg.setColor( QColorGroup::Foreground, black );    cg.setColor( QColorGroup::Button, QColor( 192, 192, 192) );    cg.setColor( QColorGroup::Light, white );    cg.setColor( QColorGroup::Midlight, QColor( 220, 220, 220) );    cg.setColor( QColorGroup::Dark, QColor( 96, 96, 96) );    cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) );    cg.setColor( QColorGroup::Text, black );    cg.setColor( QColorGroup::BrightText, white );    cg.setColor( QColorGroup::ButtonText, black );    cg.setColor( QColorGroup::Base, white );    cg.setColor( QColorGroup::Background, QColor( 192, 192, 192) );    cg.setColor( QColorGroup::Shadow, black );    cg.setColor( QColorGroup::Highlight, black );    cg.setColor( QColorGroup::HighlightedText, white );    pal.setInactive( cg );    cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) );    cg.setColor( QColorGroup::Button, QColor( 192, 192, 192) );    cg.setColor( QColorGroup::Light, white );    cg.setColor( QColorGroup::Midlight, QColor( 220, 220, 220) );    cg.setColor( QColorGroup::Dark, QColor( 96, 96, 96) );    cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) );    cg.setColor( QColorGroup::Text, black );    cg.setColor( QColorGroup::BrightText, white );    cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) );    cg.setColor( QColorGroup::Base, white );    cg.setColor( QColorGroup::Background, QColor( 192, 192, 192) );    cg.setColor( QColorGroup::Shadow, black );    cg.setColor( QColorGroup::Highlight, black );    cg.setColor( QColorGroup::HighlightedText, white );    pal.setDisabled( cg );    fineEdit->setPalette( pal );    fineEdit->setFocusPolicy( QLineEdit::ClickFocus );    fineEdit->setFrame( TRUE );    indexMethodGroup = new QButtonGroup( this, "indexMethodGroup" );    indexMethodGroup->setGeometry( QRect( 0, 0, 320, 31 ) );     indexMethodGroup->setLineWidth( 1 );    indexMethodGroup->setTitle( tr( "Index Method" ) );    byName = new QRadioButton( indexMethodGroup, "byName" );    byName->setGeometry( QRect( 5, 12, 75, 16 ) );     byName->setText( tr( "byName" ) );    byName->setChecked( TRUE );    byIPAddress = new QRadioButton( indexMethodGroup, "byIPAddress" );    byIPAddress->setGeometry( QRect( 155, 12, 75, 16 ) );     byIPAddress->setText( tr( "byIPAddress" ) );    bySerierNo = new QRadioButton( indexMethodGroup, "bySerierNo" );    bySerierNo->setGeometry( QRect( 230, 12, 75, 16 ) );     bySerierNo->setText( tr( "bySerierNo" ) );    byTelphone = new QRadioButton( indexMethodGroup, "byTelphone" );    byTelphone->setGeometry( QRect( 80, 12, 75, 16 ) );     byTelphone->setText( tr( "byTelphone" ) );    detailFrame = new QFrame( this, "detailFrame" );    detailFrame->setGeometry( QRect( 120, 50, 200, 170 ) );     detailFrame->setBackgroundOrigin( QFrame::ParentOrigin );    detailFrame->setFrameShape( QFrame::Box );    detailFrame->setFrameShadow( QFrame::Raised );    detailFrame->setLineWidth( 1 );    overTelphone = new QLabel( detailFrame, "overTelphone" );    overTelphone->setGeometry( QRect( 5, 25, 55, 16 ) );     overTelphone->setText( tr( "Over Tel:" ) );    zhiLie = new QLabel( detailFrame, "zhiLie" );    zhiLie->setGeometry( QRect( 5, 85, 55, 16 ) );     zhiLie->setText( tr( "ZhiLie:" ) );    jiaoJieXiangEdit = new QLineEdit( detailFrame, "jiaoJieXiangEdit" );    jiaoJieXiangEdit->setGeometry( QRect( 62, 104, 33, 18 ) );     jiaoJieXiangEdit->setFocusPolicy( QLineEdit::ClickFocus );    zhuGan = new QLabel( detailFrame, "zhuGan" );    zhuGan->setGeometry( QRect( 100, 85, 55, 16 ) );     zhuGan->setText( tr( "ZhuGan:" ) );    ipAddressEdit = new QLineEdit( detailFrame, "ipAddressEdit" );    ipAddressEdit->setGeometry( QRect( 62, 44, 132, 18 ) );     ipAddressEdit->setFocusPolicy( QLineEdit::ClickFocus );    fenXianXiangEdit = new QLineEdit( detailFrame, "fenXianXiangEdit" );    fenXianXiangEdit->setGeometry( QRect( 162, 104, 32, 18 ) );     fenXianXiangEdit->setFocusPolicy( QLineEdit::ClickFocus );    jiaoJieXiang = new QLabel( detailFrame, "jiaoJieXiang" );    jiaoJieXiang->setGeometry( QRect( 5, 105, 55, 16 ) );     jiaoJieXiang->setText( tr( "JiaoJieXiang:" ) );    zhiLieEdit = new QLineEdit( detailFrame, "zhiLieEdit" );    zhiLieEdit->setGeometry( QRect( 62, 84, 33, 18 ) );     zhiLieEdit->setFocusPolicy( QLineEdit::ClickFocus );    zhuGanEdit = new QLineEdit( detailFrame, "zhuGanEdit" );    zhuGanEdit->setGeometry( QRect( 162, 84, 32, 18 ) );     zhuGanEdit->setFocusPolicy( QLineEdit::ClickFocus );    fenXianXiang = new QLabel( detailFrame, "fenXianXiang" );    fenXianXiang->setGeometry( QRect( 100, 105, 55, 16 ) );     fenXianXiang->setText( tr( "FenXianXiang:" ) );    portNoEdit = new QLineEdit( detailFrame, "portNoEdit" );    portNoEdit->setGeometry( QRect( 162, 64, 32, 18 ) );     portNoEdit->setFocusPolicy( QLineEdit::ClickFocus );    ipAddress = new QLabel( detailFrame, "ipAddress" );    ipAddress->setGeometry( QRect( 5, 45, 55, 16 ) );     ipAddress->setText( tr( "IPAddress:" ) );    portNo = new QLabel( detailFrame, "portNo" );    portNo->setGeometry( QRect( 100, 65, 60, 16 ) );     portNo->setText( tr( "PortNo.:" ) );    equipment = new QLabel( detailFrame, "equipment" );    equipment->setGeometry( QRect( 5, 65, 55, 16 ) );     equipment->setText( tr( "Equipment:" ) );    commPhone = new QLabel( detailFrame, "commPhone" );    commPhone->setGeometry( QRect( 5, 5, 55, 16 ) );     commPhone->setText( tr( "Comm Phone:" ) );    commPhoneEdit = new QLineEdit( detailFrame, "commPhoneEdit" );    commPhoneEdit->setGeometry( QRect( 62, 4, 132, 18 ) );     commPhoneEdit->setFocusPolicy( QLineEdit::ClickFocus );    address = new QLabel( detailFrame, "address" );    address->setGeometry( QRect( 5, 135, 55, 16 ) );     address->setText( tr( "Address:" ) );    overTelphoneEdit = new QLineEdit( detailFrame, "overTelphoneEdit" );    overTelphoneEdit->setGeometry( QRect( 62, 24, 132, 18 ) );     overTelphoneEdit->setFocusPolicy( QLineEdit::ClickFocus );    equipmentEdit = new QLineEdit( detailFrame, "equipmentEdit" );    equipmentEdit->setGeometry( QRect( 62, 64, 33, 18 ) );     equipmentEdit->setFocusPolicy( QLineEdit::ClickFocus );    addressEdit = new QMultiLineEdit( detailFrame, "addressEdit" );    addressEdit->setGeometry( QRect( 60, 130, 134, 32 ) );     addressEdit->setFocusPolicy( QMultiLineEdit::ClickFocus );    ListBox1 = new QListBox( this, "ListBox1" );    ListBox1->insertItem( *image2, "New Item" );    ListBox1->insertItem( *image3, "Record Item1" );    ListBox1->insertItem( *image4, "Record Item2" );    ListBox1->insertItem( *image5, "Normal" );    ListBox1->insertItem( *image5, "PHY" );    ListBox1->insertItem( *image5, "DMM" );    ListBox1->setGeometry( QRect( 0, 31, 120, 189 ) );     ListBox1->setResizePolicy( QListBox::AutoOneFit );    ListBox1->setColumnMode( QListBox::FitToHeight );    adslAtmBitmap = new AdslAtmBitmap;    adslMonitor = new AdslMonitor;    myDMM = new DMM;    // signals and slots connections    connect( commPhoneEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( anyEditChanged() ) );    connect( overTelphoneEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( anyEditChanged() ) );    connect( ipAddressEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( anyEditChanged() ) );    connect( equipmentEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( anyEditChanged() ) );    connect( portNoEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( anyEditChanged() ) );    connect( zhiLieEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( anyEditChanged() ) );    connect( zhuGanEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( anyEditChanged() ) );    connect( jiaoJieXiangEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( anyEditChanged() ) );    connect( fenXianXiangEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( anyEditChanged() ) );    connect( ListBox1, SIGNAL( clicked(QListBoxItem*) ), this, SLOT( listBoxClicked() ) );    connect( fineButton, SIGNAL( clicked() ), this, SLOT( cmdButtonClicked() ) );    connect( delButton, SIGNAL( clicked() ), this, SLOT( delCmdClicked() ) );    connect( indexMethodGroup, SIGNAL( clicked(int) ), this, SLOT( indexMethodChanged() ) );    connect( addressEdit, SIGNAL( textChanged() ), this, SLOT( multiLineEditTextChanged() ) );    connect( addressEdit, SIGNAL( textChanged() ), this, SLOT( anyEditChanged() ) );    // tab order    setTabOrder( byName, byTelphone );    setTabOrder( byTelphone, byIPAddress );    setTabOrder( byIPAddress, bySerierNo );    setTabOrder( bySerierNo, fineEdit );    setTabOrder( fineEdit, ListBox1 );    setTabOrder( ListBox1, commPhoneEdit );    setTabOrder( commPhoneEdit, overTelphoneEdit );    setTabOrder( overTelphoneEdit, ipAddressEdit );    setTabOrder( ipAddressEdit, equipmentEdit );    setTabOrder( equipmentEdit, portNoEdit );    setTabOrder( portNoEdit, zhiLieEdit );    setTabOrder( zhiLieEdit, zhuGanEdit );    setTabOrder( zhuGanEdit, jiaoJieXiangEdit );    setTabOrder( jiaoJieXiangEdit, fenXianXiangEdit );    setTabOrder( fenXianXiangEdit, addressEdit );    d_opentask( &currTask );    if( d_open( DATABASEPATH, "o", currTask) != S_OKAY ){      qWarning( "open database error!!" );    }    listboxInit();}/*   *  Destroys the object and frees any allocated resources */test_Manage::~test_Manage(){}bool test_Manage::event( QEvent *e ){    bool r =  QWidget::event( e );    if( e->type() == QEvent::Close ){      d_close(currTask);    }    return r;}void test_Manage::anyEditChanged(){    if( ( ListBox1->currentItem() ) != 0 ){      find->setText( "Modify:" );      fineEdit->setText( "" );    }}void test_Manage::cmdButtonClicked(){    QString cmdStyle,keyText;    cmdStyle = find->text();    keyText = fineEdit->text();    if(cmdStyle == "Find:"){      databaseFind( keyText );    }    else if(cmdStyle == "Modify:"){      databaseModify( );      databaseFind( "" );      listBoxClicked();    }    else if(cmdStyle == "Append:"){      databaseAppend( );    }}void test_Manage::delCmdClicked(){    databaseDelete();    databaseFind( "" );    listBoxClicked();}void test_Manage::indexMethodChanged(){    int listBoxCurrentItem;    if(byName->isChecked()){      checkedRadioButton = cName;      commPhone->setText( tr( "Comm Phone:" ) );      overTelphone->setText( tr( "Over Telphone:" ) );      ipAddress->setText( tr( "Series No:" ) );      commPhoneEdit->setMaxLength(11);      overTelphoneEdit->setMaxLength(8);      ipAddressEdit->setMaxLength(20);    }    else if(byTelphone->isChecked()){      checkedRadioButton = cCommPhone;      commPhone->setText( tr( "Name:" ) );      overTelphone->setText( tr( "Over Telphone:" ) );      ipAddress->setText( tr( "Series No:" ) );      commPhoneEdit->setMaxLength(5);      overTelphoneEdit->setMaxLength(8);      ipAddressEdit->setMaxLength(20);    }    else if(byIPAddress->isChecked()){      checkedRadioButton = cTelphone;      commPhone->setText( tr( "Comm Phone:" ) );      overTelphone->setText( tr( "Name:" ) );      ipAddress->setText( tr( "Series No:" ) );      commPhoneEdit->setMaxLength(11);      overTelphoneEdit->setMaxLength(5);      ipAddressEdit->setMaxLength(20);    }    else if(bySerierNo->isChecked()){      checkedRadioButton = cSerierNo;      commPhone->setText( tr( "Comm Phone:" ) );      overTelphone->setText( tr( "Over Telphone:" ) );      ipAddress->setText( tr( "Name:" ) );      commPhoneEdit->setMaxLength(11);      overTelphoneEdit->setMaxLength(8);      ipAddressEdit->setMaxLength(5);    }    commPhoneEdit->setText( "" );    overTelphoneEdit->setText( "" );    ipAddressEdit->setText( "" );    equipmentEdit->setText( "" );    portNoEdit->setText( "" );    zhiLieEdit->setText( "" );    zhuGanEdit->setText( "" );    jiaoJieXiangEdit->setText( "" );    fenXianXiangEdit->setText( "" );    addressEdit->setText( "" );    databaseFind( "" );    listBoxCurrentItem = ListBox1->currentItem();    if( listBoxCurrentItem == 0 ){      find->setText( "Append:" );    }    else{      find->setText( "Find:" );    }}void test_Manage::listBoxClicked(){    int item,times;    QString  currentText;    delButton->setEnabled( FALSE );    item = ListBox1->currentItem();    currentText = ListBox1->currentText();    find->setText( "Find:" );    if(item == 0){      mainPageEditTextClear();           return;    }    else if(currentText == "Normal"){      currentText = ListBox1->text( item-1 );      adslMonitor->allEditSet( &irec );      adslMonitor->resize(320,220);      adslMonitor->move(0,20);      adslMonitor->show();      qWarning( "Normal Selected!" );    }    else if(currentText == "PHY"){	qWarning( "us atm count:%d!!", irec.usAtm_count );      currentText = ListBox1->text( item-2 );      adslAtmBitmap->allEditSet( &irec );      adslAtmBitmap->resize(320,220);      adslAtmBitmap->move(0,20);      adslAtmBitmap->show();      qWarning( "PHY Selected!" );    }    else if(currentText == "DMM"){      currentText = ListBox1->text( item-3 );      myDMM->allEditSet( &irec );      myDMM->resize(320,220);      myDMM->move(0,20);      myDMM->show();      qWarning( "DMM Selected!" );

⌨️ 快捷键说明

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