CustomFileDialog::CustomFileDialog( QWidget* parent ) : QFileDialog( parent, 0, false ) { QToolButton *p = new QToolButton( this ); p->setPixmap( QPixmap( globalbookmark_xpm ) ); QToolTip::add( p, tr( "Bookmarks" ) ); bookmarkMenu = new QPopupMenu( this ); connect( bookmarkMenu, SIGNAL( activated( int ) ), this, SLOT( bookmarkChosen( int ) ) ); addId = bookmarkMenu->insertItem( "Add bookmark" ); clearId = bookmarkMenu->insertItem( QPixmap(folder_trash), "Clear bookmarks" ); bookmarkMenu->insertSeparator(); p->setPopup( bookmarkMenu ); p->setPopupDelay(0); addToolButton( p, true ); QToolButton *b = new QToolButton( this ); QToolTip::add( b, tr( "Go Home!" ) ); b->setPixmap( QPixmap( homepage_xpm ) ); connect( b, SIGNAL( clicked() ), this, SLOT( goHome() ) ); addToolButton( b ); }
PaintImageWidget::PaintImageWidget(QWidget *parent) : AdvancedImageWidget(parent), ui(new Ui::PaintImageWidget) { mSelectButton = addToolButton("Select", QIcon(":/new/prefix1/select_by_color.png")); mAddPointButton = addToolButton("Add Point To Path", QIcon(":/new/prefix1/vector_add.png"), false); mDeletePointButton = addToolButton("Delete Point", QIcon(":/new/prefix1/vector_delete.png"), false); ui->setupUi(this); }
/* * CreateSpyTool - create the spy toolbar */ void CreateSpyTool( HWND parent ) { TOOLDISPLAYINFO dinfo; RECT r; int i; GetClientRect( parent, &r ); r.bottom = r.top + GET_TOOLBAR_HEIGHT( BITMAP_Y ); memset( &dinfo, 0, sizeof( dinfo ) ); dinfo.button_size.x = BITMAP_X; dinfo.button_size.y = BITMAP_Y; dinfo.border_size.x = BORDER_X( BITMAP_X ); dinfo.border_size.y = BORDER_Y( BITMAP_Y ); dinfo.style = TOOLBAR_FIXED_STYLE; dinfo.is_fixed = TRUE; dinfo.area = r; dinfo.hook = MyToolBarProc; dinfo.helphook = spyToolBarHint; dinfo.background = NULL; dinfo.use_tips = TRUE; toolBar = ToolBarInit( parent ); ToolBarDisplay( toolBar, &dinfo ); for( i = 0; i < sizeof( toolList ) / sizeof( button ); i++ ) { addToolButton( &toolList[i] ); } ShowWindow( ToolBarWindow( toolBar ), SW_SHOWNORMAL ); UpdateWindow( ToolBarWindow( toolBar ) ); } /* CreateSpyTool */
bool AdvancedImageWidget::addPointTool(int toolID, QString name, QIcon icon) { // qDebug("AdvancedImageWidget::addPointTool(%d, _ , _)", toolID); QToolButton *toolButton = addToolButton(name, icon); WidgetToolButton toolRef(toolID, toolButton); mPointButtons.push_back(toolRef); return true; }
void ChatEditBox::createDefaultToolbars(Configuration *configuration, QDomElement toolbarsConfig) { QDomElement dockAreaConfig = getDockAreaConfigElement(configuration, toolbarsConfig, "chat_topDockArea"); QDomElement toolbarConfig = configuration->api()->createElement(dockAreaConfig, "ToolBar"); addToolButton(configuration, toolbarConfig, "autoSendAction"); addToolButton(configuration, toolbarConfig, "clearChatAction"); addToolButton(configuration, toolbarConfig, "insertEmoticonAction", Qt::ToolButtonTextBesideIcon); addToolButton(configuration, toolbarConfig, "insertImageAction"); addToolButton(configuration, toolbarConfig, "showHistoryAction"); addToolButton(configuration, toolbarConfig, "encryptionAction"); addToolButton(configuration, toolbarConfig, "editUserAction"); addToolButton(configuration, toolbarConfig, "__spacer1", Qt::ToolButtonTextBesideIcon); addToolButton(configuration, toolbarConfig, "sendAction", Qt::ToolButtonTextBesideIcon); }
LauncherWidget::LauncherWidget(QWidget *parent) : BaseStyleWidget(parent) { QLabel *m_Title = new QLabel(); m_Title->setText("@launcher"); this->setObjectName("launcher"); //this->setStyleSheet("LauncherWidget { border-image:url('Webbox::Utility::PathUtil::GetCurrentExePath() + /Skin/img/abstract.jpg') 0 0 0 0 stretch stretch; border-radius: 0px; margin:0px;}"); QPalette palette; palette.setBrush(QPalette::Window, QBrush(QColor(255, 255, 255, 240)));// Qt::transparent)); this->setPalette(palette); this->setAutoFillBackground(true); m_dockWidget = new DockWidget(this); //m_dockWidget.setupUi(this); setMouseTracking(true); connect(m_dockWidget, SIGNAL(IconClicked(int)), this, SLOT(__onItemClicked(int))); QString paths[] = { "dota2.png" , "messages.png", "safari.png", "ibooks.png", "launchpad.png", "maps.png", "facetime.png", "gamecenter.png" }; m_dockWidget->AddIcon(QPixmap(Webbox::Config::AllCfg::getIconPath().append("dota2.png")), "Dota 2 CN"); //m_dockWidget->AddIcon(QPixmap(Webbox::Utility::PathUtil::GetCurrentExePath() +"/Skin/img/vancl_round.png"), "VANCL"); m_dockWidget->AddIcon(QPixmap(Webbox::Config::AllCfg::getIconPath().append("messages.png")), "iMessage"); m_dockWidget->AddIcon(QPixmap(Webbox::Config::AllCfg::getIconPath().append("safari.png")), "Safari"); m_dockWidget->AddIcon(QPixmap(Webbox::Config::AllCfg::getIconPath().append("ibooks.png")), "iBooks"); m_dockWidget->AddIcon(QPixmap(Webbox::Config::AllCfg::getIconPath().append("launchpad.png")), "LaunchPad"); m_dockWidget->AddIcon(QPixmap(Webbox::Config::AllCfg::getIconPath().append("maps.png")), "Maps"); m_dockWidget->AddIcon(QPixmap(Webbox::Config::AllCfg::getIconPath().append("facetime.png")), "FaceTime"); m_dockWidget->AddIcon(QPixmap(Webbox::Config::AllCfg::getIconPath().append("maps.png")), "Maps"); m_dockWidget->AddIcon(QPixmap(Webbox::Config::AllCfg::getIconPath().append("gamecenter.png")), "Game Center"); QGridLayout *grid_layout = new QGridLayout(); grid_layout->setContentsMargins(0,0,0,0); grid_layout->setMargin(0); //BoxDocument *doc = DocumentManager::get int idx = 0; for (int row = 0; row < 3; ++row) { for (int col = 0; col < 5; ++col) { if (idx < 8) { Webbox::Data::LaunchProperty *_property = new Webbox::Data::LaunchProperty(); _property->icon_name = paths[idx++]; _property->name_cn = "Sample App"; grid_layout->addWidget(addToolButton(80, 80, _property), row, col, Qt::AlignCenter); } else { grid_layout->addWidget(new QWidget(), row, col, Qt::AlignCenter); } } } //int idx = 0; //for (int row = 0; row < 3; ++row) // for (int col = 0; col < 5; ++col) // { // if (idx < 8) // { // /*Webbox::Data::LaunchProperty *_property = new Webbox::Data::LaunchProperty(); // QFile file(paths[idx++]); // file.open(QIODevice::ReadOnly); // QByteArray blob = file.readAll(); // _property->setIcon(blob); // _property->setNameCN("Sample App");*/ // grid_layout->addWidget(addToolButton(80, 80, _property), row, col, Qt::AlignCenter); // } // else // { // grid_layout->addWidget(new QWidget(), row, col, Qt::AlignCenter); // } // } QVBoxLayout *main_layout = new QVBoxLayout(); main_layout->setSpacing(0); main_layout->setContentsMargins(0, 0, 0, 0); main_layout->addLayout(grid_layout); main_layout->addWidget(m_dockWidget); this->setLayout(main_layout); }