LogWindow::LogWindow(const QString & log, QWidget* parent) : QDialog(parent) { mainLayout = new QVBoxLayout(this); mainLayout->setContentsMargins(0, 0, 0, 0); textBrowser = new QTextBrowser(this); textBrowser->setOpenExternalLinks(true); textBrowser->setText(log); mainLayout->addWidget(textBrowser); QWidget* buttonsContainer = new QWidget(this); QHBoxLayout* buttonsLayout = new QHBoxLayout(buttonsContainer); clearButton = new Button(tr("Clear"), buttonsContainer); buttonsLayout->addWidget(clearButton); QObject::connect( clearButton, SIGNAL(clicked()), this, SLOT(onClearButtonClicked()) ); buttonsLayout->addStretch(); okButton = new Button(tr("Ok"), buttonsContainer); buttonsLayout->addWidget(okButton); QObject::connect( okButton, SIGNAL(clicked()), this, SLOT(accept()) ); mainLayout->addWidget(buttonsContainer); }
void WingDialogWindow::init() { this->setWindowIcon(QPixmap(":/resources/image/dialog.png")); this->move(450, 250); tabWidget->clear(); tabWidget->setTabsClosable(true); tabWidget->setMovable(true); tabWidget->setElideMode(Qt::ElideRight); connect(sendButton,SIGNAL(clicked()),this,SLOT(onSendButtonClicked())); connect(clearButton,SIGNAL(clicked()),this,SLOT(onClearButtonClicked())); connect(tabWidget,SIGNAL(tabCloseRequested(int)),SLOT(onTabCloseRequested(int))); connect(tabWidget,SIGNAL(currentChanged(int)),this,SLOT(onCurrentChanged(int))); }
LogWindow::LogWindow(QWidget* parent) : QWidget(parent, Qt::Dialog | Qt::WindowStaysOnTopHint) , _mainLayout(0) , _textBrowser(0) , _clearButton(0) { setWindowTitle( tr("Error Log") ); _mainLayout = new QVBoxLayout(this); _mainLayout->setContentsMargins(0, 0, 0, 0); _textBrowser = new QTextBrowser(this); _textBrowser->setOpenExternalLinks(true); _mainLayout->addWidget(_textBrowser); _buttonBox = new DialogButtonBox(QDialogButtonBox::StandardButtons(QDialogButtonBox::Close), Qt::Horizontal, this); _clearButton = new Button( tr("&Clear") ); _clearButton->setFocusPolicy(Qt::TabFocus); _buttonBox->addButton(_clearButton, QDialogButtonBox::ResetRole); QObject::connect( _clearButton, SIGNAL(clicked()), this, SLOT(onClearButtonClicked()) ); QObject::connect( _buttonBox, SIGNAL(rejected()), this, SLOT(onCloseButtonClicked()) ); _mainLayout->addWidget(_buttonBox); }
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), method(QUICK), type(DOUBLE), ui(new Ui::MainWindow), alpha("abcdefghijklmnopqrstuvwxyz") { ui->setupUi(this); connect(ui->sortButton, SIGNAL(clicked()), this, SLOT(onSortButtonClicked())); connect(ui->generateButton, SIGNAL(clicked()), this, SLOT(onGenerateButtonClicked())); connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(onClearButtonClicked())); connect(ui->sortMethod, SIGNAL(currentIndexChanged(int)), this, SLOT(onSortMethodChanged(int))); connect(ui->sortType, SIGNAL(currentIndexChanged(int)), this, SLOT(onSortTypeChanged(int))); connect(ui->numbers, SIGNAL(blockCountChanged(int)), this, SLOT(onNumbersBlockCountChanged(int))); connect(&sortThread, SIGNAL(end(QString, int)), this, SLOT(onSortEnd(QString, int))); ui->sortMethod->addItem("Quick"); ui->sortMethod->addItem("Merge"); ui->sortMethod->addItem("Shell"); ui->sortType->addItem("Double"); ui->sortType->addItem("String"); }
void PhonebookForm::connectSignals() { QObject::connect(this->allPhonesButton, SIGNAL(clicked()), this, SLOT(onAllPhonesButtonClicked())); QObject::connect(this->searchButton, SIGNAL(clicked()), this, SLOT(onSearchButtonClicked())); QObject::connect(this->clearButton, SIGNAL(clicked()), this, SLOT(onClearButtonClicked())); }