Пример #1
0
BuildServer::BuildServer( QWidget *parent ) : QDialog( parent )
{
    label = new QLabel( QString::fromUtf8( "正在监听..." ) ) ;
    cancelPushButton = new QPushButton( QString::fromUtf8( "取消" ) , this ) ;
    connect( cancelPushButton , SIGNAL( clicked() ) , this , SLOT( cancelSlot() ) ) ;
    tableWidget = new QTableWidget( this ) ;
    tableWidget->setColumnCount( 2 ) ;
    tableWidget->setColumnWidth( 0 , 140 );
    tableWidget->setColumnWidth( 1 , 140 ) ;
    tableWidget->setRowCount( 0 ) ;
    QStringList headers;
    headers << "HostName" << "IP" ;
    tableWidget->setHorizontalHeaderLabels( headers ) ;

    tableWidget->setEditTriggers( QTableWidget::NoEditTriggers ) ;
    tableWidget->setSelectionBehavior( QTableWidget::SelectRows ) ;
    tableWidget->setSelectionMode( QTableWidget::SingleSelection ) ;
    buttonLayout = new QHBoxLayout ;
    mainLayout = new QVBoxLayout ;
    buttonLayout->addStretch() ;
    buttonLayout->addWidget( cancelPushButton ) ;
    buttonLayout->addStretch() ;
    mainLayout->addWidget( label ) ;
    mainLayout->addWidget( tableWidget ) ;
    mainLayout->addLayout( buttonLayout ) ;
    setLayout( mainLayout ) ;
    setFixedSize( 300 , 300) ;

    connect( tableWidget , SIGNAL( itemClicked( QTableWidgetItem * ) ) , this ,
                                   SLOT( onItemClicked ( QTableWidgetItem*) ) ) ;
    listen_udp() ;
}
Пример #2
0
AddressBook::AddressBook(QWidget *parent) :
    addressText (new QTextEdit(this)),
    nameText (new QLineEdit(this)),
    nameLabel (new QLabel(tr("Name"), this)),
    addressLabel (new QLabel(tr("Address"), this)),
    addButton (new QPushButton(tr("&Add"), this)),
    submitButton (new QPushButton(tr("&Submit"), this)),
    cancelButton (new QPushButton(tr("&Cancel"), this)),
    editButton (new QPushButton(tr("&Edit"), this)),
    removeButton (new QPushButton(tr("&Remove"), this)),
    nextEntryButton (new QPushButton(tr("&Next"), this)),
    prevEntryButton (new QPushButton(tr("&Previous"), this))
{

    connect(addButton, SIGNAL(clicked()), this, SLOT(addContactSlot()));
    connect(submitButton, SIGNAL(clicked()), this, SLOT(submitContactSlot()));
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelSlot()));
    connect(editButton, SIGNAL(clicked()), this, SLOT(editContactSlot()));
    connect(removeButton, SIGNAL(clicked()), this, SLOT(removeContactSlot()));
    connect(prevEntryButton, SIGNAL(clicked()), this, SLOT(prevEntrySlot()));
    connect(nextEntryButton, SIGNAL(clicked()), this, SLOT(nextEntrySlot()));

    QVBoxLayout *buttonLayout = new QVBoxLayout();
    buttonLayout->addWidget(addButton);
    buttonLayout->addWidget(submitButton);
    buttonLayout->addWidget(cancelButton);
    buttonLayout->addWidget(editButton);
    buttonLayout->addWidget(removeButton);
    buttonLayout->addStretch();

    QHBoxLayout *navigationLayout = new QHBoxLayout();
    navigationLayout->addWidget(prevEntryButton);
    navigationLayout->addWidget(nextEntryButton);

    QGridLayout *layout = new QGridLayout();
    layout->addWidget(nameLabel, 0, 0);
    layout->addWidget(nameText, 0, 1);
    layout->addWidget(addressLabel, 1, 0, Qt::AlignTop);
    layout->addWidget(addressText, 1, 1);
    layout->addLayout(buttonLayout, 1 , 2, Qt::AlignTop);
    layout->addLayout(navigationLayout, 2, 1);

    setLayout(layout);
    setWindowTitle("Address book");

    prepareWidgetsDefaultState();
    editButton->setEnabled(false);
    removeButton->setEnabled(false);
}
Пример #3
0
CFrmSettings::CFrmSettings()
{
    this->gvc = gvContext();
    Ui_Dialog tempDia;
    tempDia.setupUi(this);
    graph = NULL;
    activeWindow = NULL;
    QString path;
#ifndef WIN32
    char *s = getenv("GVEDIT_PATH");
    if (s)
	path = s;
    else
	path = GVEDIT_DATADIR;
#endif

    connect(WIDGET(QPushButton, pbAdd), SIGNAL(clicked()), this,
	    SLOT(addSlot()));
    connect(WIDGET(QPushButton, pbNew), SIGNAL(clicked()), this,
	    SLOT(newSlot()));
    connect(WIDGET(QPushButton, pbOpen), SIGNAL(clicked()), this,
	    SLOT(openSlot()));
    connect(WIDGET(QPushButton, pbSave), SIGNAL(clicked()), this,
	    SLOT(saveSlot()));
    connect(WIDGET(QPushButton, btnOK), SIGNAL(clicked()), this,
	    SLOT(okSlot()));
    connect(WIDGET(QPushButton, btnCancel), SIGNAL(clicked()), this,
	    SLOT(cancelSlot()));
    connect(WIDGET(QPushButton, pbOut), SIGNAL(clicked()), this,
	    SLOT(outputSlot()));
    connect(WIDGET(QPushButton, pbHelp), SIGNAL(clicked()), this,
	    SLOT(helpSlot()));

    connect(WIDGET(QComboBox, cbScope), SIGNAL(currentIndexChanged(int)),
	    this, SLOT(scopeChangedSlot(int)));
    scopeChangedSlot(0);


#ifndef WIN32
    loadAttrs(path + "/attrs.txt", WIDGET(QComboBox, cbNameG),
	      WIDGET(QComboBox, cbNameN), WIDGET(QComboBox, cbNameE));
#else
    loadAttrs("../share/graphviz/gvedit/attributes.txt",
	      WIDGET(QComboBox, cbNameG), WIDGET(QComboBox, cbNameN),
	      WIDGET(QComboBox, cbNameE));
#endif
    setWindowIcon(QIcon(":/images/icon.png"));
}