コード例 #1
0
void FormMultiWidget::addEditor(int idx)
{
    FormatTextEdit *editor = new FormatTextEdit(this);
    m_editors.insert(idx, editor);

    m_minusButtons.insert(idx, makeButton(m_minusIcon, SLOT(minusButtonClicked())));
    m_plusButtons.insert(idx + 1,
            new ButtonWrapper(makeButton(m_plusIcon, SLOT(plusButtonClicked())), editor));

    connect(editor, SIGNAL(textChanged()), SLOT(slotTextChanged()));
    connect(editor, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()));
    connect(editor, SIGNAL(cursorPositionChanged()), SIGNAL(cursorPositionChanged()));
    editor->installEventFilter(this);

    emit editorCreated(editor);
}
コード例 #2
0
MainWindow::MainWindow(QWidget *parent) :
	QDialog(parent)
{
	nextButton = new QPushButton(tr("next"));
	nextButton->setDisabled(true);
	connect(nextButton, SIGNAL(clicked()), this, SLOT(nextButtonClicked()));

	prevButton = new QPushButton(tr("prev"));
	connect(prevButton, SIGNAL(clicked()), this, SLOT(prevButtonClicked()));
	prevButton->setDisabled(true);

	plusButton = new QPushButton(tr("+"));
	connect(plusButton, SIGNAL(clicked()), this, SLOT(plusButtonClicked()));
	plusButton->setDisabled(true);

	minusButton = new QPushButton(tr("-"));
	connect(minusButton, SIGNAL(clicked()), this, SLOT(minusButtonClicked()));
	minusButton->setDisabled(true);

	tooOldButton = new QPushButton(tr("[:|||:]"));
	connect(tooOldButton, SIGNAL(clicked()), this, SLOT(toOldButtonClicked()));
	tooOldButton->setDisabled(true);

	gotoButton = new QPushButton(tr("Go to this quote"));
	connect(gotoButton, SIGNAL(clicked()), this, SLOT(gotoButtonClicked()));
	gotoButton->setDisabled(true);

	loadButton = new QPushButton(tr("load"));
	connect(loadButton, SIGNAL(clicked()), this, SLOT(loadButtonClicked()));

	NumberOfCurrentQuote = new QLineEdit;
	//NumberOfCurrentQuote->setDisabled(true);

	currentRating = new QLineEdit;
	currentRating->setDisabled(true);

	currentQuote = new QTextEdit;
	currentQuote->setDisabled(true);

	label1 = new QLabel;
	label2 = new QLabel;

	label1->setText("rating");
	label2->setText("number of quote");

	setWindowTitle(tr("Bash.im"));

	QHBoxLayout *buttonLayout1 = new QHBoxLayout;
	buttonLayout1->addWidget(minusButton);
	buttonLayout1->addWidget(tooOldButton);
	buttonLayout1->addWidget(plusButton);
	buttonLayout1->addWidget(label1);
	buttonLayout1->addWidget(currentRating);

	QHBoxLayout *buttonLayout2 = new QHBoxLayout;
	buttonLayout2->addWidget(loadButton);
	buttonLayout2->addWidget(prevButton);
	buttonLayout2->addWidget(nextButton);

	QHBoxLayout *buttonLayout3 = new QHBoxLayout;
	buttonLayout3->addWidget(label2);
	buttonLayout3->addWidget(NumberOfCurrentQuote);
	buttonLayout3->addWidget(gotoButton);

	QVBoxLayout *mainLayout = new QVBoxLayout;
	mainLayout->addLayout(buttonLayout1);
	mainLayout->addLayout(buttonLayout2);
	mainLayout->addWidget(currentQuote);
	mainLayout->addLayout(buttonLayout3);

	setLayout(mainLayout);
}