当前位置: 首页>>代码示例>>C++>>正文


C++ ToolButton类代码示例

本文整理汇总了C++中ToolButton的典型用法代码示例。如果您正苦于以下问题:C++ ToolButton类的具体用法?C++ ToolButton怎么用?C++ ToolButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ToolButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Q_UNUSED

void BookmarksToolbar::showBookmarkContextMenu(const QPoint &pos)
{
    Q_UNUSED(pos)

    ToolButton* button = qobject_cast<ToolButton*>(sender());
    if (!button) {
        return;
    }

    QVariant buttonPointer = QVariant::fromValue((void*) button);

    QMenu menu;
    menu.addAction(tr("Open bookmark"), this, SLOT(loadClickedBookmark()))->setData(buttonPointer);
    menu.addAction(tr("Open bookmark in new tab"), this, SLOT(loadClickedBookmarkInNewTab()))->setData(buttonPointer);
    menu.addSeparator();
    menu.addAction(qIconProvider->fromTheme("go-next"), tr("Move right"), this, SLOT(moveRight()))->setData(buttonPointer);
    menu.addAction(qIconProvider->fromTheme("go-previous"), tr("Move left"), this, SLOT(moveLeft()))->setData(buttonPointer);
    menu.addAction(tr("Edit bookmark"), this, SLOT(editBookmark()))->setData(buttonPointer);
    menu.addSeparator();
    menu.addAction(qIconProvider->fromTheme("list-remove"), tr("Remove bookmark"), this, SLOT(removeButton()))->setData(buttonPointer);

    //Prevent choosing first option with double rightclick
    QPoint position = button->mapToGlobal(pos);
    QPoint p(position.x(), position.y() + 1);
    menu.exec(p);
}
开发者ID:Klaudit,项目名称:qupzilla,代码行数:26,代码来源:bookmarkstoolbar.cpp

示例2: ToolButton

void ToolBar::addAction(QAction* action)
{
    ToolButton* button = new ToolButton(this);
    button->setAutoRaise(true);
    button->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
    button->setDefaultAction(action);
    hbox->addWidget(button);
}
开发者ID:arntanguy,项目名称:choreonoid,代码行数:8,代码来源:ToolBar.cpp

示例3: BWindow

MainWindow::MainWindow()
	:
	BWindow(BRect(0, 0, 300, 400), "Caya", B_TITLED_WINDOW, 0),
	fWorkspaceChanged(false)
{
	fStatusView = new StatusView("statusView");

	SearchBarTextControl* searchBox = 
		new SearchBarTextControl(new BMessage(kSearchContact));

	fListView = new RosterListView("buddyView");
	fListView->SetInvocationMessage(new BMessage(CAYA_OPEN_CHAT_WINDOW));
	BScrollView* scrollView = new BScrollView("scrollview", fListView,
		B_WILL_DRAW, false, true);

	// Wrench menu
	BPopUpMenu* wrenchMenu = new BPopUpMenu("Wrench");
	(void)wrenchMenu->AddItem(new BMenuItem("About" B_UTF8_ELLIPSIS,
		new BMessage(B_ABOUT_REQUESTED)));
	(void)wrenchMenu->AddItem(new BSeparatorItem());
	(void)wrenchMenu->AddItem(new BMenuItem("Preferences" B_UTF8_ELLIPSIS,
		new BMessage(CAYA_SHOW_SETTINGS)));
	(void)wrenchMenu->AddItem(new BSeparatorItem());
	(void)wrenchMenu->AddItem(new BMenuItem("Quit",
		new BMessage(B_QUIT_REQUESTED)));
	wrenchMenu->SetTargetForItems(this);

	// Tool icon
	BResources* res = CayaResources();
	BBitmap* toolIcon = IconFromResources(res, kToolIcon);
	delete res;

	// Wrench tool button
	ToolButton* wrench = new ToolButton(NULL, NULL);
	wrench->SetBitmap(toolIcon);
	wrench->SetMenu(wrenchMenu);

	SetLayout(new BGridLayout(1, 2));
	AddChild(BGridLayoutBuilder(1, 2)
		.Add(searchBox, 0, 0)
		.Add(wrench, 1, 0)
		.Add(scrollView, 0, 1, 2)
		.Add(fStatusView, 0, 2, 2)
		.SetInsets(5, 5, 5, 10)
	);

	AddShortcut('a', B_COMMAND_KEY, new BMessage(B_ABOUT_REQUESTED));
	MoveTo(BAlert::AlertPosition(Bounds().Width(), Bounds().Height() / 2));

	// Filter messages using Server
	fServer = new Server();
	AddFilter(fServer);

	CenterOnScreen();

	//TODO check for errors here
	ReplicantStatusView::InstallReplicant();
}
开发者ID:ModeenF,项目名称:Caya,代码行数:58,代码来源:MainWindow.cpp

示例4: ToolButton

void ToolBox::AddButton(int id, wxString label, int width, wxBoxSizer *box, int pad, int height, wxPanel *pan)
{
	if(pan == NULL) pan = activepanel;
	if(height == 0) height = buttonheight;
	//wxButton *button = new (_NORMAL_BLOCK, __FILE__, __LINE__) wxButton(pan, id, label, wxDefaultPosition, wxSize(width, height));
	ToolButton *button = new ToolButton(pan, id, label, wxDefaultPosition, wxSize(width, height), mainwin->diagbox);
	button->SetFont(confont);
	box->Add(button, 0, wxALIGN_CENTRE_HORIZONTAL|wxALIGN_CENTRE_VERTICAL|wxTOP|wxBOTTOM, pad);
}
开发者ID:HypoModel,项目名称:HypoModBase,代码行数:9,代码来源:hypocontrols.cpp

示例5: PlotTab

    PlotTab( bool parametric,  QWidget *parent ):
        QMainWindow( parent )
    {
        Plot *plot = new Plot( parametric, this );
        setCentralWidget( plot );
    
        QToolBar *toolBar = new QToolBar( this );

#ifndef QT_NO_PRINTER
        ToolButton *btnPrint = new ToolButton( "Print", toolBar );
        toolBar->addWidget( btnPrint );
        QObject::connect( btnPrint, SIGNAL( clicked() ),
            plot, SLOT( printPlot() ) );
#endif
    
        ToolButton *btnOverlay = new ToolButton( "Overlay", toolBar );
        btnOverlay->setCheckable( true );
        toolBar->addWidget( btnOverlay );
        QObject::connect( btnOverlay, SIGNAL( toggled( bool ) ),
            plot, SLOT( setOverlaying( bool ) ) );
    
        if ( parametric )
        {
            QComboBox *parameterBox = new QComboBox( toolBar );

            parameterBox->addItem( "Uniform" );
            parameterBox->addItem( "Centripetral" );
            parameterBox->addItem( "Chordal" );
            parameterBox->addItem( "Manhattan" );
            toolBar->addWidget( parameterBox );
            connect( parameterBox, SIGNAL( activated( const QString & ) ),
                plot, SLOT( setParametric( const QString & ) ) );

            parameterBox->setCurrentIndex( 2 ); // chordal
            plot->setParametric( parameterBox->currentText() );

            ToolButton *btnClosed = new ToolButton( "Closed", toolBar );
            btnClosed->setCheckable( true );
            toolBar->addWidget( btnClosed );
            QObject::connect( btnClosed, SIGNAL( toggled( bool ) ),
                plot, SLOT( setClosed( bool ) ) );
        }

        QComboBox *boundaryBox = new QComboBox( toolBar );

        boundaryBox->addItem( "Natural" );
        boundaryBox->addItem( "Linear Runout" );
        boundaryBox->addItem( "Parabolic Runout" );
        boundaryBox->addItem( "Cubic Runout" );
        boundaryBox->addItem( "Not a Knot" );

        toolBar->addWidget( boundaryBox );
        connect( boundaryBox, SIGNAL( activated( const QString & ) ),
            plot, SLOT( setBoundaryCondition( const QString & ) ) );
    
        addToolBar( toolBar );
    }
开发者ID:Au-Zone,项目名称:qwt,代码行数:57,代码来源:main.cpp

示例6: loadClickedBookmark

void BookmarksToolbar::loadClickedBookmark()
{
    ToolButton* button = qobject_cast<ToolButton*>(sender());
    if (!button) {
        return;
    }

    Bookmark bookmark = button->data().value<Bookmark>();

    p_QupZilla->loadAddress(bookmark.url);
}
开发者ID:unink88,项目名称:QupZilla,代码行数:11,代码来源:bookmarkstoolbar.cpp

示例7: loadClickedBookmarkInNewTab

void BookmarksToolbar::loadClickedBookmarkInNewTab()
{
    ToolButton* button = qobject_cast<ToolButton*>(sender());
    if (!button) {
        return;
    }

    Bookmark bookmark = button->data().value<Bookmark>();

    p_QupZilla->tabWidget()->addView(bookmark.url);
}
开发者ID:unink88,项目名称:QupZilla,代码行数:11,代码来源:bookmarkstoolbar.cpp

示例8: ProfileInstance

ToolButton* LauncherWidget::addToolButton(int w, int h, Webbox::Data::LaunchProperty *_p) // QString iconPath, QString buttonText)
{
	QFont font = ProfileInstance().AppFont;
	font.setPointSize(11); 
	//QPixmap p;
	//p.loadFromData(_p->getIcon());
	ToolButton *btn = new ToolButton(w, h, QPixmap(Webbox::Config::AllCfg::getIconPath()+"/"+_p->icon_name));
	btn->setText(_p->name_cn);  
	btn->setFont(font);  
	 
	return btn;
}
开发者ID:dreamxstudio,项目名称:webbox,代码行数:12,代码来源:LauncherWidget.cpp

示例9: editBookmark

void BookmarksToolbar::editBookmark()
{
    QAction* act = qobject_cast<QAction*> (sender());
    if (!act) {
        return;
    }

    ToolButton* button = static_cast<ToolButton*>(act->data().value<void*>());
    if (!button) {
        return;
    }

    Bookmark b = button->data().value<Bookmark>();

    QDialog* dialog = new QDialog(this);
    QFormLayout* layout = new QFormLayout(dialog);
    QLabel* label = new QLabel(dialog);
    QLineEdit* editUrl = new QLineEdit(dialog);
    QLineEdit* editTitle = new QLineEdit(dialog);
    QDialogButtonBox* box = new QDialogButtonBox(dialog);
    box->addButton(QDialogButtonBox::Ok);
    box->addButton(QDialogButtonBox::Cancel);
    connect(box, SIGNAL(rejected()), dialog, SLOT(reject()));
    connect(box, SIGNAL(accepted()), dialog, SLOT(accept()));

    label->setText(tr("Edit bookmark: "));
    layout->addRow(label);
    layout->addRow(new QLabel(tr("Title: ")), editTitle);
    layout->addRow(new QLabel(tr("Url: ")), editUrl);
    layout->addRow(box);

    editUrl->setText(b.url.toString());
    editTitle->setText(b.title);
    editUrl->setCursorPosition(0);
    editTitle->setCursorPosition(0);

    dialog->setWindowTitle(tr("Edit Bookmark"));
    dialog->setMinimumSize(400, 100);
    dialog->exec();
    if (dialog->result() == QDialog::Rejected) {
        return;
    }

    QUrl url = QUrl::fromEncoded(editUrl->text().toUtf8());
    QString title = editTitle->text();

    if (url.isEmpty() || title.isEmpty()) {
        return;
    }

    m_bookmarksModel->editBookmark(b.id, title, url, b.folder);
}
开发者ID:Klaudit,项目名称:qupzilla,代码行数:52,代码来源:bookmarkstoolbar.cpp

示例10: showOnlyIconsChanged

void BookmarksToolbar::showOnlyIconsChanged()
{
    m_toolButtonStyle = m_bookmarksModel->isShowingOnlyIconsInToolbar() ? Qt::ToolButtonIconOnly : Qt::ToolButtonTextBesideIcon;

    for (int i = 0; i < m_layout->count(); ++i) {
        ToolButton* button = qobject_cast<ToolButton*>(m_layout->itemAt(i)->widget());
        if (!button) {
            continue;
        }

        button->setToolButtonStyle(m_toolButtonStyle);
    }
}
开发者ID:Klaudit,项目名称:qupzilla,代码行数:13,代码来源:bookmarkstoolbar.cpp

示例11: BMessage

void
ToolSelectionWindow::_AddTool(const DrawingTool* tool)
{
    BMessage* message = new BMessage(HS_TOOL_CHANGED);
    message->AddUInt32("buttons", 0);
    message->AddInt32(skTool, tool->Type());

    ToolButton* button = new ToolButton(tool->Name(), message, tool->Icon());
    button->ResizeToPreferred();
    fMatrixView->AddSubView(button);

    gToolMap.insert(std::make_pair(tool->Type(), button));
}
开发者ID:puckipedia,项目名称:ArtPaint,代码行数:13,代码来源:ToolSelectionWindow.cpp

示例12: BView

PreferencesAccounts::PreferencesAccounts()
	: BView("Accounts", B_WILL_DRAW)
{
	fListView = new BListView("accountsListView");
	fListView->SetInvocationMessage(new BMessage(kEditAccount));
	fListView->SetSelectionMessage(new BMessage(kSelect));

	BScrollView* scrollView = new BScrollView("scrollView", fListView,
		B_WILL_DRAW, false, true);

	ProtocolManager* pm = ProtocolManager::Get();

	fProtosMenu = new BPopUpMenu(NULL, true);
	for (uint32 i = 0; i < pm->CountProtocolAddOns(); i++) {
		CayaProtocolAddOn* addOn = pm->ProtocolAddOnAt(i);
		ProtocolSettings* settings = new ProtocolSettings(addOn);

		// Add accounts to list view
		_LoadListView(settings);

		// Add menu items
		BMessage* msg = new BMessage(kAddAccount);
		msg->AddPointer("settings", settings);

		BitmapMenuItem* item = new BitmapMenuItem(
			addOn->FriendlySignature(), msg, addOn->Icon());
		fProtosMenu->AddItem(item);
	}

	ToolButton* proto = new ToolButton("+", NULL);
	proto->SetMenu(fProtosMenu);
	fDelButton = new ToolButton("-", new BMessage(kDelAccount));
	fEditButton = new ToolButton("Edit...", new BMessage(kEditAccount));
	fDelButton->SetEnabled(false);
	fEditButton->SetEnabled(false);

	const float spacing = be_control_look->DefaultItemSpacing();

	SetLayout(new BGroupLayout(B_HORIZONTAL, spacing));
	AddChild(BGroupLayoutBuilder(B_VERTICAL)
		.Add(scrollView)
		.AddGroup(B_HORIZONTAL, spacing)
			.Add(proto)
			.Add(fDelButton)
			.AddGlue()
			.Add(fEditButton)
		.End()
		.SetInsets(spacing, spacing, spacing, spacing)
	);
}
开发者ID:ModeenF,项目名称:Caya,代码行数:50,代码来源:PreferencesAccounts.cpp

示例13: indexOfLastBookmark

int BookmarksToolbar::indexOfLastBookmark()
{
    for (int i = m_layout->count() - 1; i >= 0; i--) {
        ToolButton* button = qobject_cast<ToolButton*>(m_layout->itemAt(i)->widget());
        if (!button) {
            continue;
        }

        if (!button->menu()) {
            return i + 1;
        }
    }

    return 0;
}
开发者ID:unink88,项目名称:QupZilla,代码行数:15,代码来源:bookmarkstoolbar.cpp

示例14: removeButton

void BookmarksToolbar::removeButton()
{
    QAction* act = qobject_cast<QAction*> (sender());
    if (!act) {
        return;
    }

    ToolButton* button = (ToolButton*) act->data().value<void*>();
    if (!button) {
        return;
    }

    Bookmark bookmark = button->data().value<Bookmark>();
    m_bookmarksModel->removeBookmark(bookmark.id);
}
开发者ID:unink88,项目名称:QupZilla,代码行数:15,代码来源:bookmarkstoolbar.cpp

示例15: removeBookmark

void BookmarksToolbar::removeBookmark(const BookmarksModel::Bookmark &bookmark)
{
    for (int i = 0; i < m_layout->count(); i++) {
        ToolButton* button = qobject_cast<ToolButton*>(m_layout->itemAt(i)->widget());
        if (!button) {
            continue;
        }

        Bookmark book = button->data().value<Bookmark>();

        if (book == bookmark) {
            delete button;
            return;
        }
    }
}
开发者ID:unink88,项目名称:QupZilla,代码行数:16,代码来源:bookmarkstoolbar.cpp


注:本文中的ToolButton类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。