OurUserItemWidget::OurUserItemWidget(QWidget* parent) :
    QWidget(parent)
{
    statusButton = createToolButton(QIcon(StatusHelper::getInfo(Status::Offline).iconPath), QSize(24, 24), "Change Status");
    statusButton->setPopupMode(QToolButton::InstantPopup);

    QToolButton* copyFriendAddressButton = createToolButton(QIcon(":/icons/page_copy.png"), QSize(16, 16), "Copy Friend Address");
    connect(copyFriendAddressButton, &QToolButton::clicked, this, &OurUserItemWidget::onCopyFriendAddressButtonClicked);

    QMenu* statusMenu = new QMenu(statusButton);
    QList<QAction*> statusActions;
    for (int i = 0; i <= StatusHelper::MAX_STATUS; i ++) {
        StatusHelper::Info statusInfo = StatusHelper::getInfo(i);
        QAction* statusAction = new QAction(QIcon(statusInfo.iconPath), statusInfo.name, statusMenu);
        statusAction->setData(i);
        connect(statusAction, &QAction::triggered, this, &OurUserItemWidget::onStatusActionTriggered);
        statusActions << statusAction;
    }
    statusMenu->addActions(QList<QAction*>() << statusActions);
    statusButton->setMenu(statusMenu);

    usernameWidget = new EditableLabelWidget(this);
    usernameWidget->setText(Settings::getInstance().getUsername());
    usernameWidget->label->setTextElide(true);
    usernameWidget->label->setTextElideMode(Qt::ElideRight);
    usernameWidget->label->setShowToolTipOnElide(true);
    usernameWidget->setMinimumWidth(10);
    connect(usernameWidget, &EditableLabelWidget::textChanged, this, &OurUserItemWidget::onUsernameChanged);

    statusMessageWidget = new EditableLabelWidget(this);
    statusMessageWidget->setText(Settings::getInstance().getStatusMessage());
    statusMessageWidget->label->setTextElide(true);
    statusMessageWidget->label->setTextElideMode(Qt::ElideRight);
    statusMessageWidget->label->setShowToolTipOnElide(true);
    statusMessageWidget->setMinimumWidth(10);
    QPalette palette;
    palette.setColor(QPalette::Foreground, Qt::gray);
    statusMessageWidget->label->setPalette(palette);
    connect(statusMessageWidget, &EditableLabelWidget::textChanged, this, &OurUserItemWidget::onStatusMessageChanged);

    QWidget* userInformationWidget = new QWidget(this);
    QVBoxLayout* userInformationLayout = new QVBoxLayout(userInformationWidget);
    userInformationLayout->setContentsMargins(0, 0, 0, 0);
    userInformationLayout->setSpacing(0);
    userInformationLayout->addWidget(usernameWidget, 0, Qt::AlignVCenter);
    userInformationLayout->addWidget(statusMessageWidget, 0, Qt::AlignVCenter);

    QHBoxLayout* layout = new QHBoxLayout(this);
    layout->setContentsMargins(2, 2, 2, 0);
    layout->setSpacing(2);
    layout->addWidget(statusButton, 0, Qt::AlignVCenter);
    layout->addWidget(userInformationWidget);
    layout->addWidget(copyFriendAddressButton, 0, Qt::AlignRight | Qt::AlignVCenter);

    setFocusPolicy(Qt::ClickFocus);
}
示例#2
0
QDesignerQ3WidgetStack::QDesignerQ3WidgetStack(QWidget *parent) : 
    Q3WidgetStack(parent), 
    m_prev(createToolButton(this, Qt::LeftArrow,  QLatin1String("__qt__passive_prev"))),
    m_next(createToolButton(this, Qt::RightArrow, QLatin1String("__qt__passive_next")))
{
    connect(m_prev, SIGNAL(clicked()), this, SLOT(prevPage()));
    connect(m_next, SIGNAL(clicked()), this, SLOT(nextPage()));
    updateButtons();

    connect(this, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentChanged(int)));
}
示例#3
0
BtFindWidget::BtFindWidget(QWidget* parent)
    : QWidget(parent) {
    createLayout();
    createToolButton(CResMgr::findWidget::icon_close(), "", SLOT(hide()));
    createTextEditor();
    createToolButton(CResMgr::findWidget::icon_previous(), tr("Previous"), SLOT(findPrevious()));
    createToolButton(CResMgr::findWidget::icon_next(), tr("Next"), SLOT(findNext()));
    createCaseCheckBox();
    createSpacer();
    setFocusProxy(m_textEditor);
}
示例#4
0
// ---------------  QStackedWidgetPreviewEventFilter
QStackedWidgetPreviewEventFilter::QStackedWidgetPreviewEventFilter(QStackedWidget *parent) :
    QObject(parent),
    m_buttonToolTipEnabled(false), // Not on preview
    m_stackedWidget(parent),
    m_prev(createToolButton(m_stackedWidget, Qt::LeftArrow,  QLatin1String("__qt__passive_prev"))),
    m_next(createToolButton(m_stackedWidget, Qt::RightArrow, QLatin1String("__qt__passive_next")))
{
    connect(m_prev, SIGNAL(clicked()), this, SLOT(prevPage()));
    connect(m_next, SIGNAL(clicked()), this, SLOT(nextPage()));

    updateButtons();
    m_stackedWidget->installEventFilter(this);
    m_prev->installEventFilter(this);
    m_next->installEventFilter(this);
}
示例#5
0
void KviWindow::createTextEncodingButton(QWidget * pPar)
{
	if(m_pTextEncodingButton)
		delete m_pTextEncodingButton;
	m_pTextEncodingButton = createToolButton(pPar, "text_encoding_button", KviIconManager::TextEncoding, __tr2qs("Text encoding"), false);
	connect(m_pTextEncodingButton, SIGNAL(clicked()), this, SLOT(textEncodingButtonClicked()));
}
void AMScanViewPlotToolsButtonView::refresh()
{
	// Clear the view.

	clear();

	// Construct new view, according to the present tool information.

	if (tools_) {

		int toolCount = tools_->tools().count();

		// Iterate through all available tools, creating a button for each.

		for (int toolIndex = 0; toolIndex < toolCount; toolIndex++) {
			MPlotAbstractTool *tool = tools_->tools().at(toolIndex);

			if (tool) {
				QToolButton *button = createToolButton(tool);
				buttons_->addButton(button, toolIndex);
				layout_->addWidget(button);
			}
		}
	}

	// Update view.

	update();
}
示例#7
0
//! [0]
SortingBox::SortingBox()
{
//! [0] //! [1]
    setMouseTracking(true);
//! [1] //! [2]
    setBackgroundRole(QPalette::Base);
//! [2]

    itemInMotion = 0;

//! [3]
    newCircleButton = createToolButton(tr("New Circle"),
                                       QIcon(":/images/circle.png"),
                                       SLOT(createNewCircle()));

    newSquareButton = createToolButton(tr("New Square"),
                                       QIcon(":/images/square.png"),
                                       SLOT(createNewSquare()));

    newTriangleButton = createToolButton(tr("New Triangle"),
                                         QIcon(":/images/triangle.png"),
                                         SLOT(createNewTriangle()));

    circlePath.addEllipse(QRect(0, 0, 100, 100));
    squarePath.addRect(QRect(0, 0, 100, 100));

    qreal x = trianglePath.currentPosition().x();
    qreal y = trianglePath.currentPosition().y();
    trianglePath.moveTo(x + 120 / 2, y);
    trianglePath.lineTo(0, 100);
    trianglePath.lineTo(120, 100);
    trianglePath.lineTo(x + 120 / 2, y);

//! [3] //! [4]
    setWindowTitle(tr("Tool Tips"));
    resize(500, 300);

    createShapeItem(circlePath, tr("Circle"), initialItemPosition(circlePath),
                    initialItemColor());
    createShapeItem(squarePath, tr("Square"), initialItemPosition(squarePath),
                    initialItemColor());
    createShapeItem(trianglePath, tr("Triangle"),
                    initialItemPosition(trianglePath), initialItemColor());
}
OurUserItemWidget::OurUserItemWidget(QWidget* parent) :
    QWidget(parent)
{
    statusButton = createToolButton(QIcon(StatusHelper::getInfo(Status::Offline).iconPath), QSize(24, 24), "Change Status");
    statusButton->setPopupMode(QToolButton::InstantPopup);

    QToolButton* renameUsernameButton = createToolButton(QIcon(":/icons/textfield_rename.png"), QSize(16, 16), "Change Username");
    QToolButton* copyUserIdButton = createToolButton(QIcon(":/icons/page_copy.png"), QSize(16, 16), "Copy User ID");
    connect(renameUsernameButton, &QToolButton::clicked, this, &OurUserItemWidget::onRenameUsernameButtonClicked);
    connect(copyUserIdButton, &QToolButton::clicked, this, &OurUserItemWidget::onCopyUserIdButtonClicked);

    QMenu* statusMenu = new QMenu(statusButton);
    QList<QAction*> statusActions;
    for (int i = 0; i <= StatusHelper::MAX_STATUS; i ++) {
        StatusHelper::Info statusInfo = StatusHelper::getInfo(i);
        QAction* statusAction = new QAction(QIcon(statusInfo.iconPath), statusInfo.name, statusMenu);
        statusAction->setData(i);
        connect(statusAction, &QAction::triggered, this, &OurUserItemWidget::onStatusActionTriggered);
        statusActions << statusAction;
    }
    statusMenu->addActions(QList<QAction*>() << statusActions);
    statusButton->setMenu(statusMenu);

    usernameStackedWidget = new QStackedWidget(this);

    usernameLabel = new QLabel(Settings::getInstance().getUsername(), usernameStackedWidget);

    usernameEdit = new RenameEditWidget(usernameStackedWidget, QSize(10, 10));
    connect(usernameEdit, &QLineEdit::editingFinished,      this, &OurUserItemWidget::onUsernameChange);
    connect(usernameEdit, &RenameEditWidget::escPressed,    this, &OurUserItemWidget::onUsernameChange);

    usernameStackedWidget->addWidget(usernameLabel);
    usernameStackedWidget->addWidget(usernameEdit);
    usernameStackedWidget->setCurrentWidget(usernameLabel);

    QHBoxLayout* layout = new QHBoxLayout(this);
    layout->setContentsMargins(2, 2, 2, 0);
    layout->setSpacing(2);

    layout->addWidget(statusButton, 0, Qt::AlignVCenter);
    layout->addWidget(usernameStackedWidget, 10, Qt::AlignVCenter);
    layout->addWidget(renameUsernameButton, 0, Qt::AlignRight | Qt::AlignVCenter);
    layout->addWidget(copyUserIdButton, 0, Qt::AlignRight | Qt::AlignVCenter);
}
LocalTrackGroupView::LocalTrackGroupView(int channelIndex, MainWindow *mainFrame) :
    index(channelIndex),
    mainFrame(mainFrame),
    peakMeterOnly(false),
    preparingToTransmit(false)
{
    toolButton = createToolButton();
    topPanel->layout()->addWidget(toolButton);

    xmitButton = createXmitButton();
    layout()->addWidget(xmitButton);

    QObject::connect(toolButton, SIGNAL(clicked()), this, SLOT(showMenu()));
    QObject::connect(groupNameField, SIGNAL(editingFinished()), this, SIGNAL(
                         nameChanged()));
    QObject::connect(xmitButton, SIGNAL(toggled(bool)), this, SLOT(toggleTransmitingStatus(bool)));

    groupNameField->setAlignment(Qt::AlignHCenter);

    translateUi();
}
示例#10
0
void ToolBar::initializeItems()
{
    mCursorButton = createToolButton(mActMap[CURSOR]);
    mEraserButton = createToolButton(mActMap[ERASER]);
    mPenButton = createToolButton(mActMap[PEN]);
    mLineButton = createToolButton(mActMap[LINE]);
    mColorPickerButton = createToolButton(mActMap[COLORPICKER]);
    mMagnifierButton = createToolButton(mActMap[MAGNIFIER]);
    mSprayButton = createToolButton(mActMap[SPRAY]);
    mFillButton = createToolButton(mActMap[FILL]);
    mRectangleButton = createToolButton(mActMap[RECTANGLE]);
    mEllipseButton = createToolButton(mActMap[ELLIPSE]);
    mCurveButton = createToolButton(mActMap[CURVELINE]);
    mTextButton = createToolButton(mActMap[TEXT]);

    QGridLayout *bLayout = new QGridLayout();
    bLayout->setMargin(3);
    bLayout->addWidget(mCursorButton, 0, 0);
    bLayout->addWidget(mEraserButton, 0, 1);
    bLayout->addWidget(mColorPickerButton, 1, 0);
    bLayout->addWidget(mMagnifierButton, 1, 1);
    bLayout->addWidget(mPenButton, 2, 0);
    bLayout->addWidget(mLineButton, 2, 1);
    bLayout->addWidget(mSprayButton, 3, 0);
    bLayout->addWidget(mFillButton, 3, 1);
    bLayout->addWidget(mRectangleButton, 4, 0);
    bLayout->addWidget(mEllipseButton, 4, 1);
    bLayout->addWidget(mCurveButton, 5, 0);
    bLayout->addWidget(mTextButton, 5, 1);

    QWidget *bWidget = new QWidget();
    bWidget->setLayout(bLayout);

    mPColorChooser = new ColorChooser(0, 0, 0, this);
    mPColorChooser->setStatusTip(tr("Primary color"));
    mPColorChooser->setToolTip(tr("Primary color"));
    connect(mPColorChooser, SIGNAL(sendColor(QColor)), this, SLOT(primaryColorChanged(QColor)));
    connect(mPColorChooser, SIGNAL(colorDialogClosed()), this, SIGNAL(colorDialogClosed()));

    mSColorChooser = new ColorChooser(255, 255, 255, this);
    mSColorChooser->setStatusTip(tr("Secondary color"));
    mSColorChooser->setToolTip(tr("Secondary color"));
    connect(mSColorChooser, SIGNAL(sendColor(QColor)), this, SLOT(secondaryColorChanged(QColor)));
    connect(mSColorChooser, SIGNAL(colorDialogClosed()), this, SIGNAL(colorDialogClosed()));

    QSpinBox *penSizeSpin = new QSpinBox();
    penSizeSpin->setRange(1, 20);
    penSizeSpin->setValue(1);
    penSizeSpin->setStatusTip(tr("Pen size"));
    penSizeSpin->setToolTip(tr("Pen size"));
    connect(penSizeSpin, SIGNAL(valueChanged(int)), this, SLOT(penValueChanged(int)));

    QGridLayout *tLayout = new QGridLayout();
    tLayout->setMargin(3);
    tLayout->addWidget(mPColorChooser, 0, 0);
    tLayout->addWidget(mSColorChooser, 0, 1);
    tLayout->addWidget(penSizeSpin, 1, 0, 1, 2);

    QWidget *tWidget = new QWidget();
    tWidget->setLayout(tLayout);

    addWidget(bWidget);
    addSeparator();
    addWidget(tWidget);
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->setWindowIcon(QIcon(":/new/prefix1/images/VirtualPool.png"));
    testLabel = new QLabel();
    testLabel2 = new QLabel();
    testLabel3 = new QLabel();
    button_new = createToolButton(QIcon(":/new/prefix1/images/new.png"), tr("新建"));
    button_start = createToolButton(QIcon(":/new/prefix1/images/right.png"), tr("启动"));
    button_delete = createToolButton(QIcon(":/new/prefix1/images/delete.png"), tr("删除"));
    button_login = createToolButton(QIcon(":/new/prefix1/images/login.png"), tr("远程登录"));
    button_test = createToolButton(QIcon(":/new/prefix1/images/network.png"), tr("网络体检"));

    QGroupBox *vmInfo = new QGroupBox(tr("配置信息"));
    QGroupBox *vmList = new QGroupBox(tr("虚拟机池"));
    processBar = new CRoundProcessBar(this);

    nameEdit = new QLineEdit();
    ostypeEdit = new QLineEdit();
    cpuEdit = new QLineEdit();
    memoryEdit = new QLineEdit();
    vramEdit = new QLineEdit();
    bootEdit = new QLineEdit();
    diskTypeEdit = new QLineEdit();
    diskSpaceEdit = new QLineEdit();
    networkEdit = new QLineEdit();
    ipEdit = new QLineEdit();
    netmaskEdit = new QLineEdit();
    testEdit = new QLineEdit();

    memorySpinBox = new QSpinBox();
    memorySlider = new QSlider(Qt::Horizontal);
    memorySlider->setTickPosition(QSlider::TicksBelow);
    memorySlider->setTickInterval(100);

    /* 以下为layout部分 */

    QHBoxLayout *headLayout = new QHBoxLayout;
    QVBoxLayout *resultLayout = new QVBoxLayout;

    headLayout->addWidget(button_new);
    headLayout->addWidget(button_start);
    headLayout->addWidget(button_delete);
    headLayout->addWidget(button_login);
    headLayout->addWidget(button_test);
    headLayout->addWidget(processBar);
    headLayout->addLayout(resultLayout);

    resultLayout->addWidget(testLabel);
    resultLayout->addWidget(testLabel2);
    resultLayout->addWidget(testLabel3);
    resultLayout->setSpacing(0);

    headLayout->setAlignment(Qt::AlignLeft);

    QHBoxLayout* memoryLayout = new QHBoxLayout;
    QLabel* memoryLabel = new QLabel(tr("内存"));
    memoryLabel->setMinimumWidth(78);
    memoryLayout->addWidget(memoryLabel);
    memoryLayout->addWidget(memorySpinBox);
    memoryLayout->addWidget(memorySlider);

    QFormLayout *infoLayout = new QFormLayout;
    vmInfo->setLayout(infoLayout);
    infoLayout->addRow(tr("名称"), nameEdit);
    infoLayout->addRow(tr("操作系统"), ostypeEdit);
    infoLayout->addRow(tr("CPU核数"), cpuEdit);
    infoLayout->addRow(memoryLayout);
    infoLayout->addRow(tr("虚拟磁盘格式"), diskTypeEdit);
    infoLayout->addRow(tr("磁盘剩余容量"), diskSpaceEdit);
    infoLayout->addRow(tr("网络连接方式"), networkEdit);
    infoLayout->addRow(tr("IP地址"), ipEdit);
    infoLayout->addRow(tr("子网掩码"), netmaskEdit);
    infoLayout->addRow(tr("显存"), vramEdit);
    infoLayout->addRow(tr("启动顺序"), bootEdit);
    processBar->setScanValue("0");


    infoLayout->setVerticalSpacing(15);

    QVBoxLayout *vms = new QVBoxLayout;
    vms->addWidget(listWidget);
    vmList->setLayout(vms);
    vmList->setMaximumWidth(200);
    QHBoxLayout *bodyLayout = new QHBoxLayout;
    bodyLayout->addWidget(vmList);
    bodyLayout->addWidget(vmInfo);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addLayout(headLayout);
    mainLayout->addLayout(bodyLayout);

    QWidget *mainWidget = new QWidget;
    mainWidget->setLayout(mainLayout);
    setCentralWidget(mainWidget);

//    if(listWidget->count() > 0)
//        on_item_clicked(listWidget->item(0));
    /* UI部分 */
    this->setStyleSheet("QLineEdit{background: rgb(240,240,240);selection-background-color: darkgrey; padding:0px; margin:0px;}");
}
示例#12
0
EditorWidget::EditorWidget(QString theme, QWidget *parent) :
	QWidget(parent),
	editor_rich_text(new EditorRichText(this)),
	editor_plain_text(new CodeEditor(this, CodeEditor::Html)),
	pag_stacked(new QStackedWidget(this)),
	m_state(Clean),
	m_initialPag(RichTextIndex)
{
	m_theme = theme;
	m_color = editor_rich_text->textColor();

	connect(editor_plain_text, SIGNAL(textChanged()), this, SLOT(plainTextChanged()));
	connect(editor_rich_text, SIGNAL(textChanged()), this, SLOT(richTextChanged()));
	connect(editor_rich_text, SIGNAL(simplifyRichTextChanged(bool)), this, SLOT(richTextChanged()));
	connect(editor_rich_text, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(currentCharFormatChanged(QTextCharFormat)));
	connect(editor_rich_text, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged()));

	list_smile = new QListWidget(this);
	list_smile->setMaximumSize(QSize(155, 16777215));
	list_smile->setMovement(QListView::Static);
	list_smile->setResizeMode(QListView::Adjust);
	list_smile->setViewMode(QListView::IconMode);
	connect(list_smile, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(list_smile_itemDoubleClicked(QListWidgetItem*)));

	toolbar_find_replace = new QWidget(this);
	toolbar_find_replace->setMinimumSize(QSize(0, 30));

	QVBoxLayout *main_layout = new QVBoxLayout(this);
	main_layout->setContentsMargins(0, 0, 0, 0);
	main_layout->setSpacing(4);

		QHBoxLayout *toolbar_layout = new QHBoxLayout();
		toolbar_layout->setContentsMargins(0, 0, 0, 0);
		toolbar_layout->setSpacing(10);

			QToolBar *toolbar_edit = new QToolBar(this);
			toolbar_edit->setMinimumSize(QSize(0, 30));
			toolbar_edit->setIconSize(QSize(20, 20));
			toolbar_edit->setStyleSheet("QToolBar{border:0px;}");
		// Save Pdf
		/*		m_pdf_action = createAction(QIcon(m_theme +"img16/pdf.png"), tr("Exportar a PDF") +"...", false, toolbar_edit);
				m_pdf_action->setPriority(QAction::LowPriority);
				m_pdf_action->setShortcut(Qt::CTRL + Qt::Key_D);
				connect(m_pdf_action, SIGNAL(triggered()), this, SLOT(on_edit_export_pdf()));
			toolbar_edit->addAction(m_pdf_action);
			toolbar_edit->addSeparator();*/
		// combos font and size
				QWidget *toolbar_font_input = new QWidget(this);
				QHBoxLayout *combofont_layout = new QHBoxLayout(toolbar_font_input);
				combofont_layout->setContentsMargins(0, 0, 2, 0);
					m_font_input = new QFontComboBox(toolbar_edit);
					connect(m_font_input, SIGNAL(activated(QString)), this, SLOT(on_edit_font(QString)));
				combofont_layout->addWidget(m_font_input);
					m_font_size_input = new QComboBox(toolbar_edit);
					QFontDatabase font_db;
					foreach(int size, font_db.standardSizes())
						m_font_size_input->addItem(QString::number(size));
					connect(m_font_size_input, SIGNAL(activated(QString)), this, SLOT(on_edit_font_size(QString)));
				combofont_layout->addWidget(m_font_size_input);
			//	combofont_layout->setStretch(0, 1);

			toolbar_edit->addWidget(toolbar_font_input);
			toolbar_edit->addSeparator();
		// cut, copy, paste
				m_cut_action = createAction(QIcon(m_theme +"img16/edit_cut.png"), tr("Cortar"), false, toolbar_edit);
				m_cut_action->setPriority(QAction::LowPriority);
				m_cut_action->setShortcut(QKeySequence::Cut);
				connect(m_cut_action, SIGNAL(triggered()), this, SLOT(on_edit_cut()));
			toolbar_edit->addAction(m_cut_action);
				m_copy_action = createAction(QIcon(m_theme +"img16/edit_copy.png"), tr("Copiar"), false, toolbar_edit);
				m_copy_action->setPriority(QAction::LowPriority);
				m_copy_action->setShortcut(QKeySequence::Copy);
				connect(m_copy_action, SIGNAL(triggered()), this, SLOT(on_edit_copy()));
			toolbar_edit->addAction(m_copy_action);
				m_paste_action = createAction(QIcon(m_theme +"img16/edit_paste.png"), tr("Pegar"), false, toolbar_edit);
				m_paste_action->setPriority(QAction::LowPriority);
				m_paste_action->setShortcut(QKeySequence::Paste);
				connect(m_paste_action, SIGNAL(triggered()), this, SLOT(on_edit_paste()));
			toolbar_edit->addAction(m_paste_action);
			toolbar_edit->addSeparator();
		// undo, redo
				m_undo_action = createAction(QIcon(m_theme +"img16/edit_deshacer.png"), tr("Deshacer"), false, toolbar_edit);
				m_undo_action->setShortcut(QKeySequence::Undo);
				connect(m_undo_action, SIGNAL(triggered()), this, SLOT(on_edit_undo()));
			toolbar_edit->addAction(m_undo_action);
				m_redo_action = createAction(QIcon(m_theme +"img16/edit_rehacer.png"), tr("Rehacer"), false, toolbar_edit);
				m_redo_action->setPriority(QAction::LowPriority);
				m_redo_action->setShortcut(QKeySequence::Redo);
				connect(m_redo_action, SIGNAL(triggered()), this, SLOT(on_edit_redo()));
			toolbar_edit->addAction(m_redo_action);
			toolbar_edit->addSeparator();
		// bold, italic, underline, ,
				m_bold_action = createAction(QIcon(m_theme +"img16/edit_negrita.png"), tr("Negrita"), true, toolbar_edit);
				m_bold_action->setPriority(QAction::LowPriority);
				m_bold_action->setShortcut(Qt::CTRL + Qt::Key_B);
				connect(m_bold_action, SIGNAL(triggered()), this, SLOT(on_edit_bold()));
			toolbar_edit->addAction(m_bold_action);
				m_italic_action = createAction(QIcon(m_theme +"img16/edit_cursiva.png"), tr("Cursiva"), true, toolbar_edit);
				m_italic_action->setPriority(QAction::LowPriority);
				m_italic_action->setShortcut(Qt::CTRL + Qt::Key_I);
				connect(m_italic_action, SIGNAL(triggered()), this, SLOT(on_edit_italic()));
			toolbar_edit->addAction(m_italic_action);
				m_underline_action = createAction(QIcon(m_theme +"img16/edit_subrayada.png"), tr("Subrayado"), true, toolbar_edit);
				m_underline_action->setPriority(QAction::LowPriority);
				m_underline_action->setShortcut(Qt::CTRL + Qt::Key_U);
				connect(m_underline_action, SIGNAL(triggered()), this, SLOT(on_edit_underline()));
			toolbar_edit->addAction(m_underline_action);
			toolbar_edit->addSeparator();
		// align: left, center, right, justify
				QActionGroup *grp = new QActionGroup(toolbar_edit);
				connect(grp, SIGNAL(triggered(QAction*)), this, SLOT(on_edit_text_align(QAction*)));
				if (QApplication::isLeftToRight()) {
					m_align_left_action   = createAction(QIcon(m_theme +"img16/edit_text_left.png"), tr("Izquierdo"), true, grp);
					m_align_center_action = createAction(QIcon(m_theme +"img16/edit_text_center.png"), tr("Centro"), true, grp);
					m_align_right_action  = createAction(QIcon(m_theme +"img16/edit_text_right.png"), tr("Derecho"), true, grp);
				} else {
					m_align_right_action  = createAction(QIcon(m_theme +"img16/edit_text_right.png"), tr("Derecho"), true, grp);
					m_align_center_action = createAction(QIcon(m_theme +"img16/edit_text_center.png"), tr("Centro"), true, grp);
					m_align_left_action   = createAction(QIcon(m_theme +"img16/edit_text_left.png"), tr("Izquierdo"), true, grp);
				}
				m_align_justify_action = createAction(QIcon(m_theme +"img16/edit_text_justify.png"), tr("Justificado"), true, grp);
				m_align_left_action->setPriority(QAction::LowPriority);
				m_align_left_action->setShortcut(Qt::CTRL + Qt::Key_L);
				m_align_center_action->setPriority(QAction::LowPriority);
				m_align_center_action->setShortcut(Qt::CTRL + Qt::Key_E);
				m_align_right_action->setPriority(QAction::LowPriority);
				m_align_right_action->setShortcut(Qt::CTRL + Qt::Key_R);
				m_align_justify_action->setPriority(QAction::LowPriority);
				m_align_justify_action->setShortcut(Qt::CTRL + Qt::Key_J);
			toolbar_edit->addActions(grp->actions());
			toolbar_edit->addSeparator();
		// superscript, subscript
				m_valign_sup_action = createAction(QIcon(m_theme +"img16/edit_text_super.png"), tr("Superíndice"), true, toolbar_edit);
				connect(m_valign_sup_action, SIGNAL(triggered(bool)), this, SLOT(on_edit_valign_sup()));
			toolbar_edit->addAction(m_valign_sup_action);
				m_valign_sub_action = createAction(QIcon(m_theme +"img16/edit_text_subs.png"), tr("Subíndice"), true, toolbar_edit);
				connect(m_valign_sub_action, SIGNAL(triggered(bool)), this, SLOT(on_edit_valign_sub()));
			toolbar_edit->addAction(m_valign_sub_action);
			toolbar_edit->addSeparator();
		// image, link, color, simplify
				m_image_action = createAction(QIcon(m_theme +"img16/edit_imagen.png"), tr("Imagen"), false, toolbar_edit);
				connect(m_image_action, SIGNAL(triggered()), this, SLOT(on_edit_image()));
			toolbar_edit->addAction(m_image_action);
				m_link_action = createAction(QIcon(m_theme +"img16/edit_enlace.png"), tr("Enlace"), true, toolbar_edit);
				connect(m_link_action, SIGNAL(triggered(bool)), this, SLOT(on_edit_link(bool)));
			toolbar_edit->addAction(m_link_action);
				QPixmap pix(16, 16);
				pix.fill(Qt::black);
				m_color_action = createAction(QIcon(pix), tr("Color") +"...", false, toolbar_edit);
				connect(m_color_action, SIGNAL(triggered()), this, SLOT(on_edit_color()));
			toolbar_edit->addAction(m_color_action);
			toolbar_edit->addSeparator();
				m_simplify_richtext_action = createAction(QIcon(m_theme +"img16/edit_simplify_richtext.png"), tr("Simplificar") +" Html", true, toolbar_edit);
				m_simplify_richtext_action->setChecked(editor_rich_text->simplifyRichText());
				connect(m_simplify_richtext_action, SIGNAL(triggered(bool)), editor_rich_text, SLOT(setSimplifyRichText(bool)));
				connect(editor_rich_text, SIGNAL(simplifyRichTextChanged(bool)), m_simplify_richtext_action, SLOT(setChecked(bool)));
			toolbar_edit->addAction(m_simplify_richtext_action);

		toolbar_layout->addWidget(toolbar_edit);

			QToolBar *toolbar_opts = new QToolBar(this);
			toolbar_opts->setIconSize(QSize(20, 20));
			toolbar_opts->setMinimumSize(QSize(30, 30));
			toolbar_opts->setStyleSheet("QToolBar{border:0px;}");
				m_find_replace_text_action = createAction(QIcon(m_theme +"img16/edit_buscar.png"), tr("Buscar") +"/"+ tr("Reemplazar"), true, toolbar_opts);
				m_find_replace_text_action->setPriority(QAction::LowPriority);
				m_find_replace_text_action->setShortcut(QKeySequence::Find);
				connect(m_find_replace_text_action, SIGNAL(triggered(bool)), this, SLOT(on_show_find_replace(bool)));
			toolbar_opts->addAction(m_find_replace_text_action);
				m_rich_plain_action = createAction(QIcon(m_theme +"img16/script.png"), tr("Editor") +"/"+ tr("Código"), true, toolbar_opts);
				connect(m_rich_plain_action, SIGNAL(triggered(bool)), this, SLOT(on_show_source(bool)));
			toolbar_opts->addAction(m_rich_plain_action);
				m_smiles_action = createAction(QIcon(m_theme +"img16/smile.png"), tr("Smiles"), true, toolbar_opts);
				connect(m_smiles_action, SIGNAL(triggered(bool)), list_smile, SLOT(setVisible(bool)));
			toolbar_opts->addAction(m_smiles_action);

		toolbar_layout->addWidget(toolbar_opts);
		toolbar_layout->setStretch(0, 1);

	main_layout->addLayout(toolbar_layout);

		QHBoxLayout *edit_smiles_layout = new QHBoxLayout();
		edit_smiles_layout->setContentsMargins(0, 0, 0, 0);
		edit_smiles_layout->setSpacing(4);

			QWidget *rich_edit = new QWidget();
				QVBoxLayout *rich_edit_layout = new QVBoxLayout(rich_edit);
				rich_edit_layout->setContentsMargins(0, 0, 0, 0);
				rich_edit_layout->addWidget(editor_rich_text);
			pag_stacked->addWidget(rich_edit);

			QWidget *plain_edit = new QWidget();
				QVBoxLayout *plain_edit_layout = new QVBoxLayout(plain_edit);
				plain_edit_layout->setContentsMargins(0, 0, 0, 0);
				plain_edit_layout->addWidget(editor_plain_text);
			pag_stacked->addWidget(plain_edit);
			connect(pag_stacked, SIGNAL(currentChanged(int)), this, SLOT(pagIndexChanged(int)));

		edit_smiles_layout->addWidget(pag_stacked);
		edit_smiles_layout->addWidget(list_smile);

	main_layout->addLayout(edit_smiles_layout);

		QGridLayout *gridLayout = new QGridLayout(toolbar_find_replace);
		gridLayout->setSpacing(4);
		gridLayout->setContentsMargins(0, 0, 0, 0);
			QLabel *lb_find = new QLabel(tr("Buscar")+":", toolbar_find_replace);
		gridLayout->addWidget(lb_find, 0, 0, 1, 1);
			txt_find = new QLineEdit(toolbar_find_replace);
			txt_find->setMinimumSize(QSize(0, 24));
			connect(txt_find, SIGNAL(textChanged(QString)), this, SLOT(txtFindTextChanged(QString)));
		gridLayout->addWidget(txt_find, 0, 1, 1, 1);
			QToolButton *btnFindBack = createToolButton(QIcon(m_theme +"img16/edit_buscar_anterior.png"), tr("Buscar anterior"), toolbar_find_replace);
			btnFindBack->setShortcut(QKeySequence::FindPrevious);
			connect(btnFindBack, SIGNAL(clicked()), this, SLOT(btnFindBack_clicked()));
		gridLayout->addWidget(btnFindBack, 0, 2, 1, 1);
			QToolButton *btnFindNext = createToolButton(QIcon(m_theme +"img16/edit_buscar_siguiente.png"), tr("Buscar siguiente"), toolbar_find_replace);
			btnFindBack->setShortcut(QKeySequence::FindNext);
			connect(btnFindNext, SIGNAL(clicked()), this, SLOT(btnFindNext_clicked()));
		gridLayout->addWidget(btnFindNext, 0, 3, 1, 1);
			chkCaseSensitive = new QCheckBox(tr("Coincidir mayúsculas/minúsculas"), toolbar_find_replace);
			chkCaseSensitive->setChecked(false);
			connect(chkCaseSensitive, SIGNAL(toggled(bool)), this, SLOT(chkCaseSensitive_toggled(bool)));
		gridLayout->addWidget(chkCaseSensitive, 0, 5, 1, 1);
			QCheckBox *chkReplace = new QCheckBox(tr("Reemplazar por") +":", toolbar_find_replace);
			chkReplace->setChecked(false);
			connect(chkReplace, SIGNAL(toggled(bool)), this, SLOT(chkReplace_toggled(bool)));
		gridLayout->addWidget(chkReplace, 1, 0, 1, 1);
			txt_replace = new QLineEdit(toolbar_find_replace);
			txt_replace->setEnabled(false);
			txt_replace->setMinimumSize(QSize(0, 24));
		gridLayout->addWidget(txt_replace, 1, 1, 1, 1);
			btnReplace = createToolButton(QIcon(m_theme +"img16/edit_reemplazar.png"), tr("Reemplazar"), toolbar_find_replace);
			btnReplace->setEnabled(false);
			connect(btnReplace, SIGNAL(clicked()), this, SLOT(btnReplace_clicked()));
		gridLayout->addWidget(btnReplace, 1, 2, 1, 1);
			btnReplaceAndNext = createToolButton(QIcon(m_theme +"img16/edit_reemplazar.png"), tr("Reemplazar siguiente"), toolbar_find_replace);
			btnReplaceAndNext->setEnabled(false);
			connect(btnReplaceAndNext, SIGNAL(clicked()), this, SLOT(btnReplaceAndNext_clicked()));
		gridLayout->addWidget(btnReplaceAndNext, 1, 3, 1, 1);
			btnReplaceAll = createToolButton(QIcon(m_theme +"img16/edit_reemplazar.png"), tr("Reemplazar todo"), toolbar_find_replace);
			btnReplaceAll->setEnabled(false);
			connect(btnReplaceAll, SIGNAL(clicked()), this, SLOT(btnReplaceAll_clicked()));
		gridLayout->addWidget(btnReplaceAll, 1, 4, 1, 1);
			chkWholeWords = new QCheckBox(tr("Solo palabras completas"), toolbar_find_replace);
		gridLayout->addWidget(chkWholeWords, 1, 5, 1, 1);

	main_layout->addWidget(toolbar_find_replace);

#ifndef QT_NO_CLIPBOARD
	connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged()));
#endif

	showSource(m_initialPag == RichTextIndex ? false : true);
	showFindReplace(false);
	showSmiles(false);
	setTabStopWidth(40);

	fontChanged(editor_rich_text->font());
	colorChanged(editor_rich_text->textColor());
	alignmentChanged(editor_rich_text->alignment());
}
示例#13
0
/*!
  \internal
  \brief Creates tool box on the right side.
 */
void Ui::MainWindow::createToolBox()
{
    // tool box of several tools
    QWidget *toolBoxContent = new QWidget;
    QGridLayout *layout = new QGridLayout(toolBoxContent);
    layout->setMargin(1);
    layout->setSpacing(2);
    toolBoxContent->setLayout(layout);

    QToolButton *selectToolButton = createToolButton(selectToolAction);
    layout->addWidget(selectToolButton, 0, 0, 1, 1);
    QToolButton *moveToolButton = createToolButton(moveToolAction);
    layout->addWidget(moveToolButton, 0, 1, 1, 1);

    QToolButton *paintCanToolButton = createToolButton(paintCanToolAction);
    layout->addWidget(paintCanToolButton, 1, 0, 1, 1);
    QToolButton *eraserToolButton = createToolButton(eraserToolAction);
    layout->addWidget(eraserToolButton, 1, 1, 1, 1);

    QToolButton *textToolButton = createToolButton(textToolAction);
    layout->addWidget(textToolButton, 2, 0, 1, 1);

    QToolButton *paintbrushToolButton = createToolButton(paintbrushToolAction);
    layout->addWidget(paintbrushToolButton, 3, 0, 1, 1);
    QToolButton *pencilToolButton = createToolButton(pencilToolAction);
    layout->addWidget(pencilToolButton, 3, 1, 1, 1);

    QToolButton *lineToolButton = createToolButton(lineToolAction);
    layout->addWidget(lineToolButton, 4, 0, 1, 1);
    QToolButton *curveToolButton = createToolButton(curveToolAction);
    layout->addWidget(curveToolButton, 4, 1, 1, 1);

    QToolButton *ellipseToolButton = createToolButton(ellipseToolAction);
    layout->addWidget(ellipseToolButton, 5, 0, 1, 1);
    QToolButton *rectangleToolButton = createToolButton(rectangleToolAction);
    layout->addWidget(rectangleToolButton, 5, 1, 1, 1);

    QToolButton *roundRectangleToolButton = createToolButton(roundRectangleToolAction);
    layout->addWidget(roundRectangleToolButton, 6, 0, 1, 1);
    QToolButton *polygonToolButton = createToolButton(polygonToolAction);
    layout->addWidget(polygonToolButton, 6, 1, 1, 1);

    ci = new ColorIndicator(toolBoxContent);
    layout->addWidget(ci, 7, 0, 2, 2, Qt::AlignCenter);

    QToolBar *toolBox = actionManager->toolBar(Core::ID::TOOL_BOX);
    toolBox->setObjectName("ToolBox");
    toolBox->setOrientation(Qt::Vertical);
    toolBox->addWidget(toolBoxContent);
    toolBox->setAllowedAreas(Qt::LeftToolBarArea | Qt::RightToolBarArea);
    addToolBar(Qt::LeftToolBarArea, toolBox);
}
//=============================================================================
sstQt01PathPaintWidgetCls::sstQt01PathPaintWidgetCls(sstMisc01PrtFilCls      *poTmpPrt,
                                                     sstQt01PathStoreViewCls *poTmpPathStorage)
{

  Q_INIT_RESOURCE(tooltips);

  if (poTmpPathStorage == NULL) assert (0);
  if (poTmpPathStorage->countItems() <= 0) assert(0);

  this->oPathStorage = poTmpPathStorage;
  this->poPrt = poTmpPrt;

  setMouseTracking(true);
    setBackgroundRole(QPalette::Base);

    newCircleButton = createToolButton(tr("New Circle"),
                                       QIcon(":/images/circle.png"),
                                       SLOT(createNewCircle()));

    newSquareButton = createToolButton(tr("New Square"),
                                       QIcon(":/images/square.png"),
                                       SLOT(createNewSquare()));

    newTriangleButton = createToolButton(tr("New Triangle"),
                                         QIcon(":/images/triangle.png"),
                                         SLOT(createNewTriangle()));

    newLineButton = createToolButton(tr("New Line"),
                                         QIcon(":/images/line.png"),
                                         SLOT(createNewLine()));

    newPolyLineButton = createToolButton(tr("New PolyLine"),
                                         QIcon(":/images/polyline.png"),
                                         SLOT(createNewPolyLine()));

    newArcButton = createToolButton(tr("New Arc"),
                                         QIcon(":/images/arc.png"),
                                         SLOT(createNewArc()));

    newTextButton = createToolButton(tr("New Text"),
                                         QIcon(":/images/text.png"),
                                         SLOT(createNewText()));

    //=============================================================================
    // Create item templates
    circlePath.addEllipse(QRect(0, 0, 100, 100));
    squarePath.addRect(QRect(0, 0, 100, 100));

    qreal x = trianglePath.currentPosition().x();
    qreal y = trianglePath.currentPosition().y();
    trianglePath.moveTo(x + 120 / 2, y);
    trianglePath.lineTo(0, 100);
    trianglePath.lineTo(120, 100);
    trianglePath.lineTo(x + 120 / 2, y);

    linePath.moveTo( 0, 0);
    linePath.lineTo(100, 100);

    polylinePath.moveTo( 0, 0);
    polylinePath.lineTo(25, 75);
    polylinePath.lineTo(100, 100);

    // arcPath.moveTo( 150, 150);
    QRect oRect(100,100,200,200);
    arcPath.arcMoveTo(oRect,0);
    arcPath.arcTo(oRect,0,45);

    QFont oFont;
    oFont.setPointSize(50);
    // oFont.s
    QString oQStr = "A";
    textPath.moveTo( 0, 0);
    textPath.addText(50,50,oFont,oQStr);
    //=============================================================================

    setWindowTitle(tr("Tool Tips"));
    this->setMinimumSize(350,350);  // Get Size for 7 Buttons

    iActualItemIndex = 0;
    iItemInMotionIndex = 0;

}