Example #1
0
//! [3]
QVariant QTreeModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid())
        return QVariant();
    //Node *node = nodeFromIndex(index);
    if (role == Qt::DecorationRole){
        QTreeItem *parentItem = static_cast<QTreeItem*>(index.internalPointer());

        if(index.column()!=0)
            return QVariant();
        QIcon icon;
        if(parentItem->childCount()>0){
            parentItem->setNodeType(1);
            icon.addPixmap(QPixmap(QString::fromUtf8(":/images/closeFolder.png")), QIcon::Normal, QIcon::Off);
            icon.addPixmap(QPixmap(QString::fromUtf8(":/images/openFolder.png")), QIcon::Normal, QIcon::On);
        }else{
            icon.addPixmap(QPixmap(QString::fromUtf8(":/images/page.png")), QIcon::Normal, QIcon::Off);
        }
        return icon;
    }
    if (role != Qt::DisplayRole)
        return QVariant();
    QTreeItem *item = static_cast<QTreeItem*>(index.internalPointer());

    return item->data(index.column());
}
Example #2
0
QIcon QFileIconProviderPrivate::getHaikuIcon(const QFileInfo &fi) const
{
    QIcon retIcon;
    
	BNode node(fi.canonicalFilePath().toUtf8().constData());
	if (node.InitCheck() == B_OK) {
		BNodeInfo nodeinfo(&node);
		
		BBitmap *hIcon = new BBitmap(BRect(0, 0, 15, 15), B_RGBA32);
		nodeinfo.GetTrackerIcon(hIcon, B_MINI_ICON);
		if(hIcon) {
			QPixmap p = QPixmap::fromHaikuBitmap(hIcon);
			retIcon.addPixmap(p);
			delete hIcon;
		}

		BBitmap *hIconBig = new BBitmap(BRect(0, 0, 31, 31), B_RGBA32);
		nodeinfo.GetTrackerIcon(hIcon, B_LARGE_ICON);
		if(hIconBig) {
			QPixmap p = QPixmap::fromHaikuBitmap(hIconBig);
			retIcon.addPixmap(p);
			delete hIconBig;
		}		
	}	
    return retIcon;
}
Example #3
0
void GSquare::change_btn_state(GCase *tmp_btn)
{
    QIcon ico;
    if (current_player == 0)
    {
        QPixmap pix("pion_rouge.png");
        pix.scaled(2, 2);
        ico.addPixmap(pix);
    }
    else
    {
        QPixmap pix("pion_noir.png");
        pix.scaled(2, 2);
        ico.addPixmap(pix);
    }

	if (this->info.getCList().empty() == false)
	{
		std::list<coord_t>::iterator	it;
		GCase* c;

		for (it = this->info.getCList().begin(); it != this->info.getCList().end(); it++)
			if ((c = static_cast<GCase*>(group_pions->button(it->x * 100 + it->y))) != NULL)
				c->setTaken(false);
		this->info.getCList().clear();
		int co = this->info.getCList().size();
	}

    ico.actualSize(QSize(tmp_btn->size().width() *2, tmp_btn->size().height() + 2));
    tmp_btn->setIcon(ico);
    tmp_btn->setIconSize(QSize(tmp_btn->size().width() , tmp_btn->size().height() ));
    tmp_btn->setAutoFillBackground(false);
    tmp_btn->setTaken(true);
    //    tmp_btn->setEnabled(false);
}
  RunManagerStatus::RunManagerStatus(QWidget *parent, Qt::WindowFlags flags, const RunManager &t_runmanager)
    : QDialog(parent, flags)
  {
    ui.setupUi(this);

    if (Application::instance().isDefaultInstance())
    {
      QIcon icon = QIcon(":/images/rm_16.png");
      icon.addPixmap(QPixmap(":/images/rm_32.png"));
      icon.addPixmap(QPixmap(":/images/rm_48.png"));
      icon.addPixmap(QPixmap(":/images/rm_64.png"));
      icon.addPixmap(QPixmap(":/images/rm_128.png"));
      icon.addPixmap(QPixmap(":/images/rm_256.png"));
      setWindowIcon(icon);
    }

    m_statuswidget = new JobStatusWidget(t_runmanager, this);

    ui.mainLayout->addWidget(m_statuswidget);
    

    std::vector<std::pair<bool, QAction *> > acts = m_statuswidget->publicActions();

    for (size_t i = 0; i < acts.size(); ++i)
    {
      ui.toolBar->addAction(acts.at(i).second);
    }
   
  }
Example #5
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QFont font("AR PL KaitiM GB", 12);
    a.setFont(font);

    //设置APP图标
    QIcon icon;

    icon.addPixmap(QPixmap(":/logo_48.png"));
    icon.addPixmap(QPixmap(":/logo_72.png"));
    icon.addPixmap(QPixmap(":/logo_96.png"));
    QApplication::setWindowIcon(icon);

    Mainwin w;
    LoginDialog dlg;

    if(dlg.exec() == QDialog::Accepted){
        w.show();
        return a.exec();
    }else{
        return 0;
    }

}
Example #6
0
QMenu* GuiTools::createProblemPopupMenu(ProjectBase* project, QWidget* mainWindow, const QPoint & iPoint,Problem* selectedProblem,int numProblem)
{
    QMenu *menu = new QMenu();

    //Open folder
    //Open folder
    QAction *openFolderAct = new QAction("Open folder",menu);
    connect(openFolderAct,SIGNAL(triggered()),selectedProblem,SLOT(openFolder()));
    QIcon icon;
    icon.addPixmap(QPixmap(QString::fromUtf8(":/icons/folder")), QIcon::Normal, QIcon::Off);
    openFolderAct->setIcon(icon);
    //openFolderAct->setIconSize(QSize(20, 20));
    menu->addAction(openFolderAct);

    //Rename problem
    QAction *renameAct = new QAction("Rename problem...",menu);
    renameAct->setData(numProblem);
    connect(renameAct,SIGNAL(triggered()),mainWindow,SLOT(renameProblem()));
    menu->addAction(renameAct);

    //Remove problem
    QAction *removeAct = new QAction("Remove problem",menu);
    removeAct->setData(numProblem);
    connect(removeAct,SIGNAL(triggered()),mainWindow,SLOT(removeProblem()));
    QIcon iconRem;
    iconRem.addPixmap(QPixmap(QString::fromUtf8(":/icons/Remove")), QIcon::Normal, QIcon::Off);
    removeAct->setIcon(iconRem);
    menu->addAction(removeAct);

    return menu;
}
Example #7
0
UBDesktopPalette::UBDesktopPalette(QWidget *parent)
    : UBActionPalette(Qt::TopLeftCorner, parent)
        , mShowHideAction(0)
        , mDisplaySelectAction(0)
{
    QList<QAction*> actions;

    mActionUniboard = new QAction(QIcon(":/images/toolbar/board.png"), tr("Show Uniboard"), this);
    connect(mActionUniboard, SIGNAL(triggered()), this, SIGNAL(uniboardClick()));
    actions << mActionUniboard;


    actions << UBApplication::mainWindow->actionPen;
    actions << UBApplication::mainWindow->actionEraser;
    actions << UBApplication::mainWindow->actionMarker;
#ifndef Q_WS_X11
    actions << UBApplication::mainWindow->actionSelector;
#endif
    actions << UBApplication::mainWindow->actionPointer;


    if (UBPlatformUtils::hasVirtualKeyboard())
    {
        actions << UBApplication::mainWindow->actionVirtualKeyboard;
        connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(toggled(bool)), this, SIGNAL(showVirtualKeyboard(bool)));
    }

    mActionCustomSelect = new QAction(QIcon(":/images/toolbar/captureArea.png"), tr("Capture Part of the Screen"), this);
    connect(mActionCustomSelect, SIGNAL(triggered()), this, SIGNAL(customClick()));
    actions << mActionCustomSelect;

    mDisplaySelectAction = new QAction(QIcon(":/images/toolbar/captureScreen.png"), tr("Capture the Screen"), this);
    connect(mDisplaySelectAction, SIGNAL(triggered()), this, SIGNAL(screenClick()));
    actions << mDisplaySelectAction;

    QIcon showHideIcon;
    showHideIcon.addPixmap(QPixmap(":/images/toolbar/eyeOpened.png"), QIcon::Normal , QIcon::On);
    showHideIcon.addPixmap(QPixmap(":/images/toolbar/eyeClosed.png"), QIcon::Normal , QIcon::Off);
    mShowHideAction = new QAction(showHideIcon, "", this);
    mShowHideAction->setCheckable(true);

    connect(mShowHideAction, SIGNAL(triggered(bool)), this, SLOT(showHideClick(bool)));
#ifndef Q_WS_X11
    actions << mShowHideAction;
#endif

    setActions(actions);
    setButtonIconSize(QSize(42, 42));

    adjustSizeAndPosition();

    //  This palette can be minimized
    QIcon maximizeIcon;
    maximizeIcon.addPixmap(QPixmap(":/images/toolbar/stylusTab.png"), QIcon::Normal, QIcon::On);
    mMaximizeAction = new QAction(maximizeIcon, tr("Show the stylus palette"), this);
    connect(mMaximizeAction, SIGNAL(triggered()), this, SLOT(maximizeMe()));
    connect(this, SIGNAL(maximizeStart()), this, SLOT(maximizeMe()));
    connect(this, SIGNAL(minimizeStart(eMinimizedLocation)), this, SLOT(minimizeMe(eMinimizedLocation)));
    setMinimizePermission(true);
}
// Draw an icon indicating opened/closing branches
static QIcon drawIndicatorIcon(const QPalette &palette, QStyle *style)
{
	QPixmap pix(14, 14);
	pix.fill(Qt::transparent);
	QStyleOption branchOption;
	branchOption.rect = QRect(2, 2, 9, 9); // ### hardcoded in qcommonstyle.cpp
	branchOption.palette = palette;
	branchOption.state = QStyle::State_Children;

	QPainter p;
	// Draw closed state
	p.begin(&pix);
	style->drawPrimitive(QStyle::PE_IndicatorBranch, &branchOption, &p);
	p.end();
	QIcon rc = pix;
	rc.addPixmap(pix, QIcon::Selected, QIcon::Off);
	// Draw opened state
	branchOption.state |= QStyle::State_Open;
	pix.fill(Qt::transparent);
	p.begin(&pix);
	style->drawPrimitive(QStyle::PE_IndicatorBranch, &branchOption, &p);
	p.end();

	rc.addPixmap(pix, QIcon::Normal, QIcon::On);
	rc.addPixmap(pix, QIcon::Selected, QIcon::On);
	return rc;
}
/* static */
void UIIconPool::addName(QIcon &icon, const QString &strName,
                         QIcon::Mode mode /* = QIcon::Normal */, QIcon::State state /* = QIcon::Off */)
{
    /* Prepare pixmap on the basis of passed value: */
    QPixmap pixmap(strName);
    /* Add pixmap: */
    icon.addPixmap(pixmap, mode, state);

#ifdef VBOX_WS_MAC
    /* Test if HiDPI icons are enabled: */
    if (!qApp->testAttribute(Qt::AA_UseHighDpiPixmaps))
        return;
#endif /* VBOX_WS_MAC */

    /* Parse name to prefix and suffix: */
    QString strPrefix = strName.section('.', 0, -2);
    QString strSuffix = strName.section('.', -1, -1);
    /* Prepare HiDPI pixmaps: */
    const QStringList aPixmapNames = QStringList() << (strPrefix + "_x2." + strSuffix)
                                                   /*<< (strPrefix + "_x3." + strSuffix)
                                                   << (strPrefix + "_x4." + strSuffix)*/;
    foreach (const QString &strPixmapName, aPixmapNames)
    {
        QPixmap pixmapHiDPI(strPixmapName);
        if (!pixmapHiDPI.isNull())
            icon.addPixmap(pixmapHiDPI, mode, state);
    }
Example #10
0
/* static */
void UIIconPool::addName(QIcon &icon, const QString &strName,
                         QIcon::Mode mode /* = QIcon::Normal */, QIcon::State state /* = QIcon::Off */)
{
    /* Prepare pixmap on the basis of passed value: */
    QPixmap pixmap(strName);
    /* Add pixmap: */
    icon.addPixmap(pixmap, mode, state);

#ifdef Q_WS_MAC
# ifdef VBOX_GUI_WITH_HIDPI
    /* Test if HiDPI icons are enabled. Works only with a patched version of Qt 4.x
     * with the changes from https://codereview.qt-project.org/#change,54636 applied. */
    if (qApp->testAttribute(Qt::AA_UseHighDpiPixmaps))
    {
        /* Parse name to prefix and suffix: */
        QString strPrefix = strName.section('.', 0, -2);
        QString strSuffix = strName.section('.', -1, -1);
        /* Prepare HiDPI pixmap on the basis of values above: */
        QPixmap pixmapHiDPI(strPrefix + "_hidpi." + strSuffix);
        /* Add HiDPI pixmap (if any): */
        if (!pixmapHiDPI.isNull())
            icon.addPixmap(pixmapHiDPI, mode, state);
    }
# endif /* VBOX_GUI_WITH_HIDPI */
#endif /* Q_WS_MAC */
}
Example #11
0
void PsMainWindow::psUpdateCounter() {
	int32 counter = App::histories().unreadFull - (cIncludeMuted() ? 0 : App::histories().unreadMuted);

    setWindowTitle((counter > 0) ? qsl("Telegram (%1)").arg(counter) : qsl("Telegram"));
	setWindowIcon(wndIcon);

    QString cnt = (counter < 1000) ? QString("%1").arg(counter) : QString("..%1").arg(counter % 100, 2, 10, QChar('0'));
    _private.setWindowBadge(counter ? cnt : QString());

	if (trayIcon) {
		bool muted = cIncludeMuted() ? (App::histories().unreadMuted >= counter) : false;
		bool dm = objc_darkMode();

		style::color bg = muted ? st::counterMuteBG : st::counterBG;
		QIcon icon;
		QImage img(psTrayIcon(dm)), imgsel(psTrayIcon(true));
		img.detach();
		imgsel.detach();
		int32 size = cRetina() ? 44 : 22;
		_placeCounter(img, size, counter, bg, (dm && muted) ? st::counterMacInvColor : st::counterColor);
		_placeCounter(imgsel, size, counter, st::white, st::counterMacInvColor);
		icon.addPixmap(QPixmap::fromImage(img, Qt::ColorOnly));
		icon.addPixmap(QPixmap::fromImage(imgsel, Qt::ColorOnly), QIcon::Selected);
		trayIcon->setIcon(icon);
	}
}
Example #12
0
// static
QIcon QPixmap::fromPmHPOINTER(HPOINTER hpointer, QPixmap *pixmap,
                              QPixmap *pixmapMini)
{
    QIcon res;

    if (hpointer == NULLHANDLE)
        return res;

    POINTERINFO info = { 0 };
    if (!WinQueryPointerInfo(hpointer, &info))
        return res;

    QPixmap pm = fromPmHBITMAP(info.hbmColor, info.hbmPointer);
    if (!pm.isNull())
        res.addPixmap(pm);

    QPixmap pmMini = fromPmHBITMAP(info.hbmMiniColor, info.hbmMiniPointer);
    if (!pmMini.isNull())
        res.addPixmap(pmMini);

    if (pixmap)
        *pixmap = pm;
    if (pixmapMini)
        *pixmapMini = pmMini;

    return res;
}
Example #13
0
QIcon NavigationBar::iconForPage(const QUrl &url, const QIcon &sIcon)
{
    QIcon icon;
    icon.addPixmap(url.scheme() == QLatin1String("qupzilla") ? QIcon(":icons/qupzilla.png").pixmap(16, 16) : _iconForUrl(url).pixmap(16, 16));
    icon.addPixmap(sIcon.pixmap(16, 16), QIcon::Active);
    return icon;
}
Example #14
0
static QIcon iconForPage(const QUrl &url, const QIcon &sIcon)
{
    QIcon icon;
    icon.addPixmap(url.scheme() == QL1S("kclient") ? QIcon(QSL(":icons/kclient.png")).pixmap(16) : IconProvider::iconForUrl(url).pixmap(16));
    icon.addPixmap(sIcon.pixmap(16), QIcon::Active);
    return icon;
}
Example #15
0
QIcon IconFactory::appIcon(AppIconFlags flags)
{
    const bool running = flags.testFlag(AppIconRunning);
    const QString suffix = running ? "-busy" : "-normal";
    const QString sessionName = qApp->property("CopyQ_session_name").toString();

    QIcon icon;

    if (sessionName.isEmpty())
        icon = QIcon::fromTheme("copyq" + suffix);

    if (icon.isNull()) {
        const QString resourceSuffix = running ? "-running" : "";
        QPixmap pix = imageFromPrefix(suffix + ".svg", "icon" + resourceSuffix);

        if (!sessionName.isEmpty()) {
            const QColor color1(0x7f, 0xca, 0x9b);
            const QColor color2 = sessionNameToColor(sessionName);
            replaceColor(&pix, color1, color2);
        }

        icon.addPixmap(pix);
    }

    if (flags.testFlag(AppIconDisabled)) {
        QIcon disabledIcon;
        foreach (const QSize &size, icon.availableSizes())
            disabledIcon.addPixmap(icon.pixmap(size, QIcon::Disabled));
        return disabledIcon;
    }
Example #16
0
QIcon NavigationBar::iconForPage(const QUrl &url, const QIcon &sIcon)
{
    QIcon icon;
    icon.addPixmap(url.scheme() == QL1S("qupzilla") ? QIcon(QSL(":icons/qupzilla.png")).pixmap(16, 16) : IconProvider::iconForUrl(url).pixmap(16, 16));
    icon.addPixmap(sIcon.pixmap(16, 16), QIcon::Active);
    return icon;
}
Example #17
0
CurveWidget::CurveWidget( QWidget* parent ) : QWidget( parent )
{
	CurveWidgetLayout = new QHBoxLayout(this);
	CurveWidgetLayout->setMargin(5);
	CurveWidgetLayout->setSpacing(5);

	layout1 = new QVBoxLayout;
	layout1->setMargin(0);
	layout1->setSpacing(5);

	invertButton = new QPushButton( this );
	invertButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
	invertButton->setIcon( IconManager::instance()->loadIcon("invert.png") );
	invertButton->setIconSize(QSize(22, 22));
	layout1->addWidget( invertButton );

	resetButton = new QPushButton( this );
	resetButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
	resetButton->setIcon( IconManager::instance()->loadIcon("reload.png") );
	resetButton->setIconSize(QSize(22, 22));
	layout1->addWidget( resetButton );
	linearButton = new QPushButton( this );
	QIcon ic;
	ic.addPixmap(IconManager::instance()->loadPixmap("curvebezier.png"), QIcon::Normal, QIcon::Off);
	ic.addPixmap(IconManager::instance()->loadPixmap("curvelinear.png"), QIcon::Normal, QIcon::On);
	linearButton->setIcon(ic);
	linearButton->setCheckable( true );
	linearButton->setChecked(false);
	linearButton->setIconSize(QSize(22, 22));
	linearButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
	layout1->addWidget( linearButton );
	spacer1 = new QSpacerItem( 2, 3, QSizePolicy::Minimum, QSizePolicy::Expanding );
	layout1->addItem( spacer1 );

	loadButton = new QPushButton( this );
	loadButton->setIcon( IconManager::instance()->loadIcon("22/document-open.png") );
	loadButton->setIconSize(QSize(22, 22));
	loadButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
	layout1->addWidget( loadButton );

	saveButton = new QPushButton( this );
	saveButton->setIcon( IconManager::instance()->loadIcon("22/document-save-as.png") );
	saveButton->setIconSize(QSize(22, 22));
	saveButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
	layout1->addWidget( saveButton );
	CurveWidgetLayout->addLayout( layout1 );

	cDisplay = new KCurve(this);
	cDisplay->setMinimumSize( QSize( 150, 150 ) );
	CurveWidgetLayout->addWidget( cDisplay );
	languageChange();

	connect(invertButton, SIGNAL(clicked()), this, SLOT(doInvert()));
	connect(resetButton, SIGNAL(clicked()), this, SLOT(doReset()));
	connect(linearButton, SIGNAL(clicked()), this, SLOT(doLinear()));
	connect(loadButton, SIGNAL(clicked()), this, SLOT(doLoad()));
	connect(saveButton, SIGNAL(clicked()), this, SLOT(doSave()));
}
 void CQTOpenGLLuaMainWindow::CreateFileActions() {
    QIcon cFileNewIcon;
    cFileNewIcon.addPixmap(QPixmap(m_pcMainWindow->GetIconDir() + "/new.png"));
    m_pcFileNewAction = new QAction(cFileNewIcon, tr("&New"), this);
    m_pcFileNewAction->setToolTip(tr("Create a new file"));
    m_pcFileNewAction->setStatusTip(tr("Create a new file"));
    m_pcFileNewAction->setShortcut(QKeySequence::New);
    connect(m_pcFileNewAction, SIGNAL(triggered()),
            this, SLOT(New()));
    QIcon cFileOpenIcon;
    cFileOpenIcon.addPixmap(QPixmap(m_pcMainWindow->GetIconDir() + "/open.png"));
    m_pcFileOpenAction = new QAction(cFileOpenIcon, tr("&Open..."), this);
    m_pcFileOpenAction->setToolTip(tr("Open a file"));
    m_pcFileOpenAction->setStatusTip(tr("Open a file"));
    m_pcFileOpenAction->setShortcut(QKeySequence::Open);
    connect(m_pcFileOpenAction, SIGNAL(triggered()),
            this, SLOT(Open()));
    for (int i = 0; i < MAX_RECENT_FILES; ++i) {
       m_pcFileOpenRecentAction[i] = new QAction(this);
       m_pcFileOpenRecentAction[i]->setVisible(false);
       connect(m_pcFileOpenRecentAction[i], SIGNAL(triggered()),
               this, SLOT(OpenRecentFile()));
    }
    QIcon cFileSaveIcon;
    cFileSaveIcon.addPixmap(QPixmap(m_pcMainWindow->GetIconDir() + "/save.png"));
    m_pcFileSaveAction = new QAction(cFileSaveIcon, tr("&Save"), this);
    m_pcFileSaveAction->setToolTip(tr("Save the current file"));
    m_pcFileSaveAction->setStatusTip(tr("Save the current file"));
    m_pcFileSaveAction->setShortcut(QKeySequence::Save);
    connect(m_pcFileSaveAction, SIGNAL(triggered()),
            this, SLOT(Save()));
    QIcon cFileSaveAsIcon;
    cFileSaveAsIcon.addPixmap(QPixmap(m_pcMainWindow->GetIconDir() + "/saveas.png"));
    m_pcFileSaveAsAction = new QAction(cFileSaveAsIcon, tr("S&ave as..."), this);
    m_pcFileSaveAsAction->setToolTip(tr("Save the current file under a new name"));
    m_pcFileSaveAsAction->setStatusTip(tr("Save the current file under a new name"));
    m_pcFileSaveAsAction->setShortcut(QKeySequence::SaveAs);
    connect(m_pcFileSaveAsAction, SIGNAL(triggered()),
            this, SLOT(SaveAs()));
    QMenu* pcMenu = menuBar()->addMenu(tr("&File"));
    pcMenu->addAction(m_pcFileNewAction);
    pcMenu->addSeparator();
    pcMenu->addAction(m_pcFileOpenAction);
    pcMenu->addSeparator();
    pcMenu->addAction(m_pcFileSaveAction);
    pcMenu->addAction(m_pcFileSaveAsAction);
    m_pcFileSeparateRecentAction = pcMenu->addSeparator();
    for (int i = 0; i < MAX_RECENT_FILES; ++i) {
       pcMenu->addAction(m_pcFileOpenRecentAction[i]);
    }
    QToolBar* pcToolBar = addToolBar(tr("File"));
    pcToolBar->setObjectName("FileToolBar");
    pcToolBar->setIconSize(QSize(32,32));
    pcToolBar->addAction(m_pcFileNewAction);
    pcToolBar->addAction(m_pcFileOpenAction);
    pcToolBar->addAction(m_pcFileSaveAction);
    UpdateRecentFiles();
 }
/**
 * Returns the pixmap for the list item.
 */
QIcon ViewProviderDocumentObjectGroup::getIcon() const
{
    QIcon groupIcon;
    groupIcon.addPixmap(QApplication::style()->standardPixmap(QStyle::SP_DirClosedIcon),
                        QIcon::Normal, QIcon::Off);
    groupIcon.addPixmap(QApplication::style()->standardPixmap(QStyle::SP_DirOpenIcon),
                        QIcon::Normal, QIcon::On);
    return groupIcon;
}
Example #20
0
QIcon IconUtils::fromResources(const QString &name) {
    QIcon icon = QIcon(QString(":/images/%1.png").arg(name));
    if (!icon.isNull()) {
        icon.addPixmap(QString(":/images/%1_active.png").arg(name), QIcon::Active);
        icon.addPixmap(QString(":/images/%1_selected.png").arg(name), QIcon::Selected);
        icon.addPixmap(QString(":/images/%1_disabled.png").arg(name), QIcon::Disabled);
    }
    return icon;
}
Example #21
0
/** Default constructor */
ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::WindowFlags flags)
	: ChatDialog(parent, flags), lobbyId(lid)
{
	/* Invoke Qt Designer generated QObject setup routine */
	ui.setupUi(this);

	connect(ui.participantsFrameButton, SIGNAL(toggled(bool)), this, SLOT(showParticipantsFrame(bool)));
	connect(ui.actionChangeNickname, SIGNAL(triggered()), this, SLOT(changeNickname()));
	connect(ui.participantsList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(participantsTreeWidgetCustomPopupMenu(QPoint)));
	connect(ui.participantsList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(participantsTreeWidgetDoubleClicked(QTreeWidgetItem*,int)));

	ui.participantsList->setColumnCount(COLUMN_COUNT);
	ui.participantsList->setColumnWidth(COLUMN_ICON, 20);
    ui.participantsList->setColumnHidden(COLUMN_ACTIVITY,true);

	muteAct = new QAction(QIcon(), tr("Mute participant"), this);
	connect(muteAct, SIGNAL(triggered()), this, SLOT(changePartipationState()));

	// Add a button to invite friends.
	//
	inviteFriendsButton = new QToolButton ;
	inviteFriendsButton->setMinimumSize(QSize(28,28)) ;
	inviteFriendsButton->setMaximumSize(QSize(28,28)) ;
	inviteFriendsButton->setText(QString()) ;
	inviteFriendsButton->setAutoRaise(true) ;
	inviteFriendsButton->setToolTip(tr("Invite friends to this lobby"));

	{
	QIcon icon ;
	icon.addPixmap(QPixmap(":/images/edit_add24.png")) ;
	inviteFriendsButton->setIcon(icon) ;
	inviteFriendsButton->setIconSize(QSize(22,22)) ;
	}

	connect(inviteFriendsButton, SIGNAL(clicked()), this , SLOT(inviteFriends()));

	getChatWidget()->addChatBarWidget(inviteFriendsButton) ;

	unsubscribeButton = new QToolButton ;
	unsubscribeButton->setMinimumSize(QSize(28,28)) ;
	unsubscribeButton->setMaximumSize(QSize(28,28)) ;
	unsubscribeButton->setText(QString()) ;
	unsubscribeButton->setAutoRaise(true) ;
	unsubscribeButton->setToolTip(tr("Leave this lobby (Unsubscribe)"));

	{
	QIcon icon ;
	icon.addPixmap(QPixmap(":/images/exit_32.png")) ;
	unsubscribeButton->setIcon(icon) ;
	unsubscribeButton->setIconSize(QSize(22,22)) ;
	}

	connect(unsubscribeButton, SIGNAL(clicked()), this , SLOT(leaveLobby()));

	getChatWidget()->addChatBarWidget(unsubscribeButton) ;
}
Example #22
0
int QfwToolBox::insertItem(int index, QWidget *widget, const QString &text)
{
    if (!widget)
        return -1;

    connect(widget, SIGNAL(destroyed(QObject*)), this, SLOT(widgetDestroyed(QObject*)));

    Page c;
    c.widget = widget;
    c.button = new QPushButton(this);
    c.button->setBackgroundRole(QPalette::Window);
    c.button->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
    c.button->setFocusPolicy(Qt::NoFocus);
    c.button->setCheckable(true);
    QString style(
        "text-align: left;"
        "background-color: lightgray;"
        "border-style: solid;"
        "border-width: 1px;"
        "border-color: darkgray;"
        "height: 20px;"
    );
    QPixmap pixOpen(branch_open);
    QPixmap pixClose(branch_closed);
    QIcon bIcon;
    bIcon.addPixmap( pixClose, QIcon::Normal, QIcon::Off );
    bIcon.addPixmap( pixOpen, QIcon::Active, QIcon::On );
    c.setIcon(bIcon);
    c.button->setStyleSheet(style);
    connect(c.button, SIGNAL(toggled(bool)), this, SLOT(buttonToggled(bool)));

    c.sv = new QFrame(this);
    QVBoxLayout* verticalLayout = new QVBoxLayout(c.sv);
    verticalLayout->setMargin(0);
    verticalLayout->addWidget(widget);
    c.sv->hide();
    c.sv->setFrameStyle(QFrame::NoFrame);

    c.setText(text);

    if (index < 0 || index >= (int)this->pageList.count())
    {
        index = this->pageList.count();
        this->pageList.append(c);
        this->layout->addWidget(c.button);
        this->layout->addWidget(c.sv);
    }
    else
    {
        this->pageList.insert(index, c);
        this->relayout();
    }
    c.button->show();
    return index;
}
Example #23
0
// Default constructor
QGAppParamInputFile::QGAppParamInputFile(QgarAppParamDescr * descr,
					 QGAppDialogMediator * med,
					 QWidget * parent,
					 QGridLayout * layout)

  : QGAbstractAppParamInput(descr, med, parent, layout)

{  
  //-- Create choose file button

  // Build icon set
  QIcon icon;
  icon.addPixmap(QPixmap(fileopen2_xpm), 
		    QIcon::Normal, QIcon::On);
  icon.addPixmap(QPixmap(d_fileopen2_xpm), 
		    QIcon::Disabled, QIcon::On);

  // Create button
  _chooseButton = new QPushButton(icon, "", this);
  _chooseButton->setFocusPolicy(Qt::NoFocus);
  _chooseButton->setFlat(true);
  // Attention: the size argument is randon. actualSize() method
  // will always return a smaller value, never bigger
  _chooseButton->setMaximumSize(icon.actualSize(QSize(50, 50),
						QIcon::Normal,
						QIcon::On));

  //-- Create value field

  _value = new QLineEdit(this);  
  _value->setMinimumSize(QSize(300, 20));
  _value->setSizePolicy(QSizePolicy(QSizePolicy::Maximum,
				    QSizePolicy::Maximum));
  _layout->addWidget(_value, _rowCounter, _colCounter);
  _colCounter++;

  //-- If base class widgets are disabled set widgets accordingly.

  _layout->addWidget(_chooseButton, _rowCounter, _colCounter, Qt::AlignLeft);
  _colCounter++;


  this->setEnabled(enabled());


  //-- Connect button to its slot

  connect(_chooseButton,  SIGNAL(clicked()), SLOT(chooseFile()));
  connect(_value, 
	  SIGNAL(textChanged(const QString&)),
	  SLOT(valueChanged()));

  // Set text field value to the default parameter value.
  reset();
}
QIcon PlaylistSequence::AddDesaturatedIcon(const QIcon& icon) {
  QIcon ret;
  for (const QSize& size : icon.availableSizes()) {
    QPixmap on(icon.pixmap(size));
    QPixmap off(DesaturatedPixmap(on));

    ret.addPixmap(off, QIcon::Normal, QIcon::Off);
    ret.addPixmap(on, QIcon::Normal, QIcon::On);
  }
  return ret;
}
Example #25
0
 void CQTOpenGLMainWindow::CreateSimulationActions() {
    /* Add the play button */
    std::string strSTDBaseDirectory(CSimulator::GetInstance().GetInstallationDirectory());
    strSTDBaseDirectory += "/simulator/visualizations/qt-opengl/icons/";
    QString strBaseDirectory(strSTDBaseDirectory.c_str());
    QIcon cPlayIcon;
    cPlayIcon.addPixmap(QPixmap(strBaseDirectory + "play_normal.png"), QIcon::Normal, QIcon::Off);
    cPlayIcon.addPixmap(QPixmap(strBaseDirectory + "play_pressed.png"), QIcon::Normal, QIcon::On);
    m_pcPlayAction = new QAction(cPlayIcon, tr("&Play"), this);
    m_pcPlayAction->setToolTip(tr("Play/pause simulation"));
    m_pcPlayAction->setStatusTip(tr("Play/pause simulation"));
    m_pcPlayAction->setCheckable(true);
    m_pcPlayAction->setShortcut(Qt::Key_P);
    /* Add the pause/step button */
    QIcon cStepIcon;
    cStepIcon.addPixmap(QPixmap(strBaseDirectory + "step_normal.png"));
    m_pcStepAction = new QAction(cStepIcon, tr("&Step"), this);
    m_pcStepAction->setToolTip(tr("Step simulation"));
    m_pcStepAction->setStatusTip(tr("Step simulation"));
    m_pcStepAction->setShortcut(Qt::Key_S);
    /* Add the fast forward button */
    QIcon cFastForwardIcon;
    cFastForwardIcon.addPixmap(QPixmap(strBaseDirectory + "fast_forward_normal.png"), QIcon::Normal, QIcon::Off);
    cFastForwardIcon.addPixmap(QPixmap(strBaseDirectory + "fast_forward_pressed.png"), QIcon::Normal, QIcon::On);
    m_pcFastForwardAction = new QAction(cFastForwardIcon, tr("&Fast Forward"), this);
    m_pcFastForwardAction->setToolTip(tr("Fast forward simulation"));
    m_pcFastForwardAction->setStatusTip(tr("Fast forward simulation"));
    m_pcFastForwardAction->setCheckable(true);
    m_pcFastForwardAction->setShortcut(Qt::Key_F);
    /* Add the reset button */
    QIcon cResetIcon;
    cResetIcon.addPixmap(QPixmap(strBaseDirectory + "reset_normal.png"));
    m_pcResetAction = new QAction(cResetIcon, tr("&Reset"), this);
    m_pcResetAction->setToolTip(tr("Reset simulation"));
    m_pcResetAction->setStatusTip(tr("Reset simulation"));
    m_pcResetAction->setShortcut(Qt::Key_R);
    /* Add the capture button */
    QIcon cCaptureIcon;
    cCaptureIcon.addPixmap(QPixmap(strBaseDirectory + "record_normal.png"), QIcon::Normal, QIcon::Off);
    cCaptureIcon.addPixmap(QPixmap(strBaseDirectory + "record_pressed.png"), QIcon::Normal, QIcon::On);
    m_pcCaptureAction = new QAction(cCaptureIcon, tr("&Capture"), this);
    m_pcCaptureAction->setToolTip(tr("Capture frames"));
    m_pcCaptureAction->setStatusTip(tr("Capture frames"));
    m_pcCaptureAction->setCheckable(true);
    m_pcCaptureAction->setShortcut(Qt::Key_C);
    /* Add the quit button */
    m_pcQuitAction = new QAction(tr("&Quit"), this);
    m_pcQuitAction->setStatusTip(tr("Quit the simulator"));
    m_pcQuitAction->setShortcut(Qt::Key_Q);
 }
Example #26
0
 void CQTOpenGLMainWindow::CreatePOVRayActions() {
    /* Add the POVRay XML button */
    QIcon cPOVRayXMLIcon;
    cPOVRayXMLIcon.addPixmap(QPixmap(m_strIconDir + "povray.png"));
    m_pcPOVRayXMLAction = new QAction(cPOVRayXMLIcon, tr("&Edit XML"), this);
    m_pcPOVRayXMLAction->setToolTip(tr("Edit POV-Ray XML configuration"));
    m_pcPOVRayXMLAction->setStatusTip(tr("Edit POV-Ray XML configuration"));
    /* Add the POVRay Preview button */
    QIcon cPOVRayPreviewIcon;
    cPOVRayPreviewIcon.addPixmap(QPixmap(m_strIconDir + "povray_preview.png"));
    m_pcPOVRayPreviewAction = new QAction(cPOVRayPreviewIcon, tr("&Preview"), this);
    m_pcPOVRayPreviewAction->setToolTip(tr("Preview POV-Ray rendering of this scene"));
    m_pcPOVRayPreviewAction->setStatusTip(tr("Preview POV-Ray rendering of this scene"));
 }
Example #27
0
QIcon generateIcon(const char* iconPath)
{
	QIcon icon;

	QString normalPath(iconPath);
	auto tokens = normalPath.split('.');
	TF_ASSERT(tokens.length() == 2);

	QString off(tokens[0]);
	QString on(tokens[0] + stateOn);
	QString ext("." + tokens[1]);

	QString disabledPath(off + modeDisabled + ext);
	QString activePath(off + modeActive + ext);
	QString selectedPath(off + modeSelected + ext);

	QString normalOnPath(on + ext);
	QString disabledOnPath(on + modeDisabled + ext);
	QString activeOnPath(on + modeActive + ext);
	QString selectedOnPath(on + modeSelected + ext);

	auto offIcon = QPixmap(normalPath);
	icon.addPixmap(offIcon, QIcon::Normal, QIcon::Off);
	icon.addPixmap(QPixmap(disabledPath), QIcon::Disabled, QIcon::Off);
	icon.addPixmap(QPixmap(activePath), QIcon::Active, QIcon::Off);
	icon.addPixmap(QPixmap(selectedPath), QIcon::Selected, QIcon::Off);

	auto onIcon = QPixmap(normalOnPath);
	if (onIcon.isNull())
	{
		QPainter p;

		auto img = offIcon.toImage().convertToFormat(QImage::Format_ARGB32);
		auto mask(img);

		auto width = mask.width();
		auto height = mask.height();
		auto outerRect = mask.rect();
		auto innerRect = QRect(width / 16, height / 16, width - width / 8, height - height / 8);

		p.begin(&mask);
		p.setCompositionMode(QPainter::CompositionMode_SourceIn);
		p.fillRect(outerRect, QApplication::palette().highlight());
		p.fillRect(innerRect, Qt::transparent);
		p.end();

		p.begin(&img);
		p.setCompositionMode(QPainter::CompositionMode_SourceOver);
		p.drawImage(0, 0, mask);
		p.end();

		onIcon.convertFromImage(img);
	}
	icon.addPixmap(onIcon, QIcon::Normal, QIcon::On);
	icon.addPixmap(QPixmap(disabledOnPath), QIcon::Disabled, QIcon::On);
	icon.addPixmap(QPixmap(activeOnPath), QIcon::Active, QIcon::On);
	icon.addPixmap(QPixmap(selectedOnPath), QIcon::Selected, QIcon::On);

	return icon;
}
Example #28
0
KviWindowToolPageButton::KviWindowToolPageButton(KviIconManager::SmallIcon eIconOff, KviIconManager::SmallIcon eIconOn, const QString & szText, QWidget * pParent, bool bOn)
    :QToolButton(pParent)
{
    setAutoRaise(true);
    setToolTip(szText);
    setObjectName("kvi_window_tool_button");
    QIcon icon;
    icon.addPixmap(*(g_pIconManager->getSmallIcon(eIconOff)),QIcon::Normal,QIcon::Off);
    icon.addPixmap(*(g_pIconManager->getSmallIcon(eIconOn)),QIcon::Active,QIcon::On);
    icon.addPixmap(*(g_pIconManager->getSmallIcon(eIconOn)),QIcon::Active);
    setIcon(icon);
    setCheckable(true);
    setChecked(bOn);
}
Example #29
0
// === WindowIcon() ===
QIcon LXCB::WindowIcon(WId win){
  //Fetch the _NET_WM_ICON for the window and return it as a QIcon
  if(DEBUG){ qDebug() << "XCB: WindowIcon()"; }
  QIcon icon;
  if(win==0){ return icon; }
  xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_icon_unchecked(&EWMH, win);
  xcb_ewmh_get_wm_icon_reply_t reply;
  if(1 == xcb_ewmh_get_wm_icon_reply(&EWMH, cookie, &reply, NULL)){
    xcb_ewmh_wm_icon_iterator_t iter = xcb_ewmh_get_wm_icon_iterator(&reply);
    //Just use the first
    bool done =false;
    while(!done){
      //Now convert the current data into a Qt image
      // - first 2 elements are width and height (removed via XCB functions)
      // - data in rows from left to right and top to bottom
      QImage image(iter.width, iter.height, QImage::Format_ARGB32); //initial setup
	uint* dat = iter.data;
	//dat+=2; //remember the first 2 element offset
	for(int i=0; i<image.byteCount()/4; ++i, ++dat){
	  ((uint*)image.bits())[i] = *dat; 
	}
      icon.addPixmap(QPixmap::fromImage(image)); //layer this pixmap onto the icon
      //Now see if there are any more icons available
      done = (iter.rem<1); //number of icons remaining
      if(!done){ xcb_ewmh_get_wm_icon_next(&iter); } //get the next icon data
    }
    xcb_ewmh_get_wm_icon_reply_wipe(&reply);
  }
  return icon;
}
Example #30
0
// ===== WindowIcon() =====
QIcon LX11::WindowIcon(WId win){
  //Use the _NET_WM_ICON value instead of the WMHints pixmaps
	// - the pixmaps are very unstable and erratic
  QIcon icon;
  Display *disp = QX11Info::display();
  Atom type;
  Atom SA = XInternAtom(disp, "_NET_WM_ICON", false);
  int format;
  unsigned long num, bytes;
  unsigned long *data = 0;
  XGetWindowProperty( disp, win, SA, 0, LONG_MAX, False, AnyPropertyType,
  	  			&type, &format, &num, &bytes, (uchar**)&data);
  if(data != 0){
    //qDebug() << "Icon Data Found:" << win;
    ulong* dat = data;
    while(dat < data+num){ //consider the fact that there may be multiple graphical layers
    //Now convert it into a Qt image
    // - first 2 elements are width and height
    // - data in rows from left to right and top to bottom
      QImage image(dat[0], dat[1], QImage::Format_ARGB32); //initial setup
	dat+=2; //remember the first 2 element offset
	for(int i=0; i<image.byteCount()/4; ++i, ++dat){
	  ((uint*)image.bits())[i] = *dat; 
	}
      icon.addPixmap(QPixmap::fromImage(image)); //layer this pixmap onto the icon
    }
    XFree(data);
  }
  return icon;
}