• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ToolButton类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: loadFolderBookmarksInTabs

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

    QString folder = b->text();
    if (folder.isEmpty()) {
        return;
    }

    foreach (const Bookmark &b, m_bookmarksModel->folderBookmarks(folder)) {
        p_QupZilla->tabWidget()->addView(b.url, b.title, Qz::NT_NotSelectedTab);
    }
}
开发者ID:Klaudit,项目名称:qupzilla,代码行数:16,代码来源:bookmarkstoolbar.cpp


示例17: while

void Xaman::initXamanButton ()
{
    QString consulta;
    consulta.append("SELECT * FROM xaman");
    QSqlQuery consultar;
    consultar.prepare(consulta);
    if(!consultar.exec()){
        QMessageBox::warning(this, "Error", "No se ha encontrado información.");
    }
    //Configuracion de la tabla que contiene el estado de las maquinas
    int fila=0;
    int col=0;

    ui->tableWidget->setRowCount(0);
    ui->tableWidget->insertRow(0);
    ui->tableWidget->setRowHeight(0,80);

    //Ciclo por item de la lista de maquinas
    while(consultar.next()){
        //Se crea el boton para representar a cada maquina
        //QToolButton *button = new QToolButton(ui->scrollArea);
        ToolButton *button = new ToolButton(ui->scrollArea);
        //qDebug() << consultar.value(0); //IP
        //qDebug() << consultar.value(1); //MAC
        //qDebug() << consultar.value(2); //Nombre del equipo

        //Configuraciones del boton
        button->setText(consultar.value(2).toString());
        button->setIp(consultar.value(0).toString());
        button->setMac(consultar.value(1).toString());
        button->update();

        if(col<9){
            ui->tableWidget->setCellWidget(fila,col,button);
            ui->tableWidget->setColumnWidth(col,ui->tableWidget->width()/8);
            col++;
            if(col==8){
                col=0;
                fila++;
                ui->tableWidget->insertRow(fila);
                ui->tableWidget->setRowHeight(fila,80);
            }
        }
        buttons.insert(num_clientes, button);
        num_clientes++;
    }
}
开发者ID:alejandrogamezg,项目名称:Xaman,代码行数:47,代码来源:xaman.cpp


示例18:

QWidget *LeftToolBox::createButton(const QString &name,QButtonGroup *group,const int id) {
	
	ToolButton *carButton = new ToolButton;
	carButton->setCheckable(true);
	carButton->setIcon(QIcon(QPixmap(name).scaled(30,30,Qt::KeepAspectRatio)));
	carButton->setIconSize(QSize(50,50));

	if (group != 0){
		group->addButton(carButton, id);
	}

	QGridLayout *layout = new QGridLayout;
	layout->addWidget(carButton,0,0,Qt::AlignHCenter);

	QWidget *widget = new QWidget;
	widget->setLayout(layout);
	return widget;
}
开发者ID:nightfly19,项目名称:renyang-learn,代码行数:18,代码来源:LeftToolBox.cpp


示例19: memnew

Variant CreateDialog::get_drag_data_fw(const Point2 &p_point, Control *p_from) {

	TreeItem *ti = favorites->get_item_at_position(p_point);
	if (ti) {
		Dictionary d;
		d["type"] = "create_favorite_drag";
		d["class"] = ti->get_text(0);

		ToolButton *tb = memnew(ToolButton);
		tb->set_icon(ti->get_icon(0));
		tb->set_text(ti->get_text(0));
		set_drag_preview(tb);

		return d;
	}

	return Variant();
}
开发者ID:RandomShaper,项目名称:godot,代码行数:18,代码来源:create_dialog.cpp


示例20: SetBackgrounds

   void SetBackgrounds()
   {
      if (!mSkin)
         return;

      wxSize size = GetClientSize();
      if (size!=mLastSize)
      {
         wxRect r( wxPoint(0,0), size );
         mLastSize = size;
         for(int t=0;t<mTools.size();t++)
         {
            ToolButton *tool = mTools[t]->mTool;
            if (tool)
               tool->SetBackground(mSkin,r,tool->GetPosition());
         }
      }
   }
开发者ID:akadjoker,项目名称:waxe,代码行数:18,代码来源:ToolBox.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ToolChain类代码示例发布时间:2022-05-31
下一篇:
C++ ToolBarItem类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap