QToolButton* ToolBar::createToolButton(QAction *act) { QToolButton *toolButton = new QToolButton(); toolButton->setMinimumSize(QSize(30, 30)); toolButton->setMaximumSize(QSize(30, 30)); toolButton->setDefaultAction(act); toolButton->setStatusTip(act->text()); return toolButton; }
QToolButton* AMScanViewPlotToolsButtonView::createToolButton(MPlotAbstractTool *tool) { QToolButton *toolButton = 0; if (tool) { toolButton = new QToolButton(); toolButton->setIcon(toolToIcon(tool)); toolButton->setIconSize(QSize(16, 16)); toolButton->setText(tool->name()); toolButton->setStatusTip(tool->description()); toolButton->setToolTip(tool->name()); toolButton->setCheckable(true); toolButton->setAutoRaise(false); } return toolButton; }
void ItemsWidget::createItems(int categoryId) { // Remove pervious buttons from grid layout this->removeItems(); // Get all items QList<Model::Item> items = Services::Item::getByCategoryId(categoryId); int i=0, col = 0, row = 1; for(QList<Model::Item>::iterator p = items.begin(); p != items.end(); ++p ) { QToolButton* button = new QToolButton; button->setObjectName(QString("%1_itemButton").arg(p->id())); button->setText((Settings::Language::getCurrentLanguage() == Settings::Language::Arabic) ? p->arabicName() : p->englishName()); if ( Settings::Language::getCurrentLanguage() == Settings::Language::English ) { if ( p->id() == 2 || p->id() == 29) button->setFont(QFont("Hacen Liner Screen Bd", 10, QFont::Normal)); else button->setFont(QFont("Hacen Liner Screen Bd", 13, QFont::Normal)); } else button->setFont(QFont("Hacen Liner Screen Bd", 13, QFont::Normal)); button->setIconSize(QSize(128,128)); //button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); button->setToolTip(button->text()); button->setStatusTip(button->text()); connect(button, SIGNAL(clicked()), signalMapper, SLOT(map())); this->signalMapper->setMapping(button, p->id()); layout->addWidget(button, row, col); col++; i++; if ( col % ButtonsPerLine == 0) { row++; col = 0; } } }
/*! Constructor * \brief This class implements the project management * * This also handles the mouse and keyboad events, and sends * when appropiate, the file names to be opened by the parent. * * \param parent Parent of the widget. */ Project::Project(QWidget *parent) : QWidget(parent) { projectLibrary = 0; m_libraryFileName = ""; m_libraryName = ""; QVBoxLayout *layout = new QVBoxLayout(this); QToolBar *toolbar = new QToolBar; QToolButton *projNew = new QToolButton(); projNew->setIcon(QIcon(Qucs::bitmapDirectory() + "project-new.png")); projNew->setStatusTip(tr("Creates a new project")); projNew->setToolTip(tr("Creates a new project")); projNew->setWhatsThis(tr("New Project\n\nCreates a new project")); QToolButton *projOpen = new QToolButton(); projOpen->setIcon(QIcon(Qucs::bitmapDirectory() + "fileopen.png")); projOpen->setStatusTip(tr("Opens an existing project")); projOpen->setToolTip(tr("Opens an existing project")); projOpen->setWhatsThis(tr("Open Project\n\nOpens an existing project")); QToolButton *addToProj = new QToolButton(); addToProj->setIcon(QIcon(Qucs::bitmapDirectory() + "filenew.png")); addToProj->setStatusTip(tr("Adds a file to current project")); addToProj->setToolTip(tr("Adds a file to current project")); addToProj->setWhatsThis(tr("Add File to Project\n\nAdds a file to current project")); QToolButton *projDel = new QToolButton(); projDel->setIcon(QIcon(Qucs::bitmapDirectory() + "fileclose.png")); projDel->setStatusTip(tr("Removes a file from current project")); projDel->setToolTip(tr("Removes a file from current project")); projDel->setWhatsThis(tr("Remove from Project\n\nRemoves a file from current project")); QToolButton *projClose = new QToolButton(); projClose->setIcon(QIcon(Qucs::bitmapDirectory() + "project-close.png")); projClose->setStatusTip(tr("Closes the current project")); projClose->setToolTip(tr("Closes the current project")); projClose->setWhatsThis(tr("Close Project\n\nCloses the current project")); connect(projNew, SIGNAL(clicked()), this, SLOT(slotNewProject())); connect(projOpen, SIGNAL(clicked()), this, SLOT(slotOpenProject())); connect(addToProj, SIGNAL(clicked()), this, SLOT(slotAddToProject())); connect(projDel, SIGNAL(clicked()), this, SLOT(slotRemoveFromProject())); connect(projClose, SIGNAL(clicked()), this, SLOT(slotCloseProject())); toolbar->addWidget(projNew); toolbar->addWidget(projOpen); toolbar->addWidget(addToProj); toolbar->addWidget(projDel); toolbar->addWidget(projClose); m_projectsSidebar = new ComponentsSidebar(this); connect(m_projectsSidebar, SIGNAL(itemClicked(const QString&, const QString&)), this, SLOT(slotOnClicked(const QString&, const QString&))); connect(m_projectsSidebar, SIGNAL(itemDoubleClicked(const QString&, const QString&)), this, SLOT(slotOnDoubleClicked(const QString&, const QString&))); layout->addWidget(toolbar); layout->addWidget(m_projectsSidebar); setWindowTitle(tr("Project View")); }
/*! * \brief Constructor. * * \param parent Parent of the widget. */ QuickOpen::QuickOpen(QWidget *parent) : QMenu(parent) { // Set window geometry setMinimumSize(300,300); QVBoxLayout *layout = new QVBoxLayout(this); // Create the toolbar QToolBar *toolbar = new QToolBar(this); QToolButton *buttonUp = new QToolButton(this); buttonUp->setIcon(Caneda::icon("go-up")); buttonUp->setShortcut(Qt::Key_Backspace); buttonUp->setStatusTip(tr("Go up one folder")); buttonUp->setToolTip(tr("Go up one folder")); buttonUp->setWhatsThis(tr("Go up one folder")); buttonBack = new QToolButton(this); buttonBack->setIcon(Caneda::icon("go-previous")); buttonBack->setShortcut(Qt::ALT + Qt::Key_Left); buttonBack->setStatusTip(tr("Go previous folder")); buttonBack->setToolTip(tr("Go previous folder")); buttonBack->setWhatsThis(tr("Go previous folder")); buttonBack->setEnabled(false); buttonForward = new QToolButton(this); buttonForward->setIcon(Caneda::icon("go-next")); buttonForward->setShortcut(Qt::ALT + Qt::Key_Right); buttonForward->setStatusTip(tr("Go next folder")); buttonForward->setToolTip(tr("Go next folder")); buttonForward->setWhatsThis(tr("Go next folder")); buttonForward->setEnabled(false); QToolButton *buttonHome = new QToolButton(this); buttonHome->setIcon(Caneda::icon("go-home")); buttonHome->setShortcut(Qt::CTRL + Qt::Key_Home); buttonHome->setStatusTip(tr("Go to the home folder")); buttonHome->setToolTip(tr("Go to the home folder")); buttonHome->setWhatsThis(tr("Go to the home folder")); // Create the filter button QToolButton *buttonFilters = new QToolButton(this); QMenu *filterMenu = new QMenu(this); filterGroup = new QActionGroup(this); buttonFilters->setIcon(Caneda::icon("configure")); buttonFilters->setPopupMode(QToolButton::InstantPopup); buttonFilters->setMenu(filterMenu); filterNone = new QAction(Caneda::icon("view-sidetree"), tr("Show all"), filterGroup); QAction *filtersSeparator = new QAction(filterGroup); filtersSeparator->setSeparator(true); filterSchematics = new QAction(Caneda::icon("application-x-caneda-schematic"), tr("Show schematics"), filterGroup); filterSymbols = new QAction(Caneda::icon("application-x-caneda-symbol"), tr("Show symbols"), filterGroup); filterLayouts = new QAction(Caneda::icon("application-x-caneda-layout"), tr("Show layouts"), filterGroup); filterSimulations = new QAction(Caneda::icon("application-x-spice-simulation-raw"), tr("Show simulations"), filterGroup); filterText = new QAction(Caneda::icon("text-plain"), tr("Show text files"), filterGroup); filterNone->setCheckable(true); filterSchematics->setCheckable(true); filterSymbols->setCheckable(true); filterLayouts->setCheckable(true); filterSimulations->setCheckable(true); filterText->setCheckable(true); Settings *settings = Settings::instance(); int index = settings->currentValue("quickopen/filter").toInt(); filterGroup->actions().at(index)->setChecked(true); filterMenu->addActions(filterGroup->actions()); // Add the buttons to the toolbar toolbar->addWidget(buttonUp); toolbar->addWidget(buttonBack); toolbar->addWidget(buttonForward); toolbar->addWidget(buttonHome); QWidget *spacer = new QWidget(this); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); toolbar->addWidget(spacer); toolbar->addWidget(buttonFilters); layout->addWidget(toolbar); // Set lineEdit properties m_filterEdit = new QLineEdit(this); m_filterEdit->setClearButtonEnabled(true); m_filterEdit->setPlaceholderText(tr("Search...")); m_filterEdit->installEventFilter(this); layout->addWidget(m_filterEdit); // Create a new filesystem model m_model = new QFileSystemModel(this); m_model->setIconProvider(new IconProvider()); m_model->setRootPath(QDir::homePath()); // Create proxy model and set its properties. m_proxyModel = new FilterProxyModel(this); m_proxyModel->setDynamicSortFilter(true); m_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); m_proxyModel->setSourceModel(m_model); // Create a list view, set properties and proxy model m_listView = new QListView(this); m_listView->setModel(m_proxyModel); m_listView->setRootIndex(m_proxyModel->mapFromSource(m_model->index(QDir::homePath()))); layout->addWidget(m_listView); // Signals and slots connections connect(buttonUp, SIGNAL(clicked()), this, SLOT(slotUpFolder())); connect(buttonBack, SIGNAL(clicked()), this, SLOT(slotBackFolder())); connect(buttonForward, SIGNAL(clicked()), this, SLOT(slotForwardFolder())); connect(buttonHome, SIGNAL(clicked()), this, SLOT(slotHomeFolder())); connect(filterNone, SIGNAL(triggered(bool)), this, SLOT(filterFileTypes())); connect(filterSchematics, SIGNAL(triggered(bool)), this, SLOT(filterFileTypes())); connect(filterSymbols, SIGNAL(triggered(bool)), this, SLOT(filterFileTypes())); connect(filterLayouts, SIGNAL(triggered(bool)), this, SLOT(filterFileTypes())); connect(filterSimulations, SIGNAL(triggered(bool)), this, SLOT(filterFileTypes())); connect(filterText, SIGNAL(triggered(bool)), this, SLOT(filterFileTypes())); connect(m_filterEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterTextChanged())); connect(m_filterEdit, SIGNAL(returnPressed()), this, SLOT(itemSelected())); connect(m_listView, SIGNAL(activated(QModelIndex)), this, SLOT(itemSelected())); // Filter the selected filetype and start with the focus on the filter filterGroup->actions().at(index)->trigger(); m_filterEdit->setFocus(); }
QBoxLayout * View::focusPanelLayout() { /* * Focus mode when not in live view. */ QLabel *focusModeLabel = new QLabel( tr("Focus mode:") ); focusMode = new FocusMode(); focusMode->setStatusTip( tr("Focus mode when not in live view") ); QObject::connect( focusMode, SIGNAL(propertyChanged(int,int)), this, SIGNAL(propertyChanged(int,int))); /* * Focus mode when in live view. */ QLabel *focusModeLiveLabel = new QLabel( tr("Live view:") ); focusModeLive = new QComboBox(); focusModeLive->setMaxCount( Map::MAX_FocusMode ); focusModeLive->setStatusTip( tr("Focus mode when in live view") ); focusModeLive->setFixedWidth( 80 ); setEvfAFList( camera ); QObject::connect( focusModeLive, SIGNAL(activated(int)), this, SLOT(toEvfAFValue(int)) ); /* * Auto focus button. */ QLabel *focusLabel = new QLabel( tr("Focus: ") ); QToolButton *focusButton = new QToolButton(); focusButton->setAutoRaise( true ); focusButton->setIcon( QIcon(":/Resources/Misc/button.png") ); focusButton->setIconSize( QSize(22, 22) ); focusButton->setStatusTip( tr("Auto focus") ); QObject::connect( focusButton, SIGNAL(pressed()), this, SLOT(autoFocusInitiated()) ); QObject::connect( focusButton, SIGNAL(released()), this, SLOT(autoFocusDiscontinued()) ); /* * Focus map to show on live view. */ QLabel *focusMapLabel = new QLabel( tr("Focus map:") ); QComboBox *focusMapComboBox = new QComboBox(); focusMapComboBox->setStatusTip( tr("Capture series of images for constructing focus map") ); focusMapComboBox->addItem( tr("Disabled") ); focusMapComboBox->addItem( tr("Enabled") ); focusMapComboBox->setFixedWidth( 80 ); focusMapComboBox->setCurrentIndex( 0 ); camera->setFocusMapSetting( 0 ); QObject::connect( focusMapComboBox, SIGNAL(activated(int)), this, SLOT(setFocusMap(int)) ); /* * Depth of field (DOF) preview. */ QLabel *dofPreviewLabel = new QLabel( tr("DOF preview:") ); QComboBox *dofPreviewComboBox = new QComboBox(); dofPreviewComboBox->addItem( tr("Disabled") ); dofPreviewComboBox->addItem( tr("Enabled") ); dofPreviewComboBox->setFixedWidth( 80 ); dofPreviewComboBox->setCurrentIndex( 0 ); QObject::connect( dofPreviewComboBox, SIGNAL(activated(int)), this, SLOT(setDOFPreview(int)) ); /* * Focus adjustment buttons. */ const bool flat = false; const int width = 22; const int height = 16; const int buttonHeight = 23; const int latency = 333; QLabel *focusAdjustmentLabel = new QLabel(); focusAdjustmentLabel->setText( tr("Focus adjustment:") ); /* * Near focus: <<< */ QPushButton *focusNear3Button = new QPushButton(); focusNear3Button->setStatusTip( tr("Near focus: large movement") ); focusNear3Button->setIcon( QIcon(":/Resources/Focus/arrow-left3.png") ); focusNear3Button->setIconSize( QSize(width, height) ); focusNear3Button->setFixedHeight( buttonHeight ); focusNear3Button->setFlat( flat ); focusNear3Button->setAutoRepeat( true ); focusNear3Button->setAutoRepeatDelay( latency ); focusNear3Button->setAutoRepeatInterval( latency ); /* * Near focus: << */ QPushButton *focusNear2Button = new QPushButton(); focusNear2Button->setStatusTip( tr("Near focus: medium movement") ); focusNear2Button->setIcon( QIcon(":/Resources/Focus/arrow-left2.png") ); focusNear2Button->setIconSize( QSize(width, height) ); focusNear2Button->setFixedHeight( buttonHeight ); focusNear2Button->setFlat( flat ); focusNear2Button->setAutoRepeat( true ); focusNear2Button->setAutoRepeatDelay( latency ); focusNear2Button->setAutoRepeatInterval( latency ); /* * Near focus: < */ QPushButton *focusNear1Button = new QPushButton(); focusNear1Button->setStatusTip( tr("Near focus: small movement") ); focusNear1Button->setIcon( QIcon(":/Resources/Focus/arrow-left1.png") ); focusNear1Button->setIconSize( QSize(width, height) ); focusNear1Button->setFixedHeight( buttonHeight ); focusNear1Button->setFlat( flat ); focusNear1Button->setAutoRepeat( true ); focusNear1Button->setAutoRepeatDelay( latency ); focusNear1Button->setAutoRepeatInterval( latency ); /* * Far focus: > */ QPushButton *focusFar1Button = new QPushButton(); focusFar1Button->setStatusTip( tr("Far focus: small movement") ); focusFar1Button->setIcon( QIcon(":/Resources/Focus/arrow-right1.png") ); focusFar1Button->setIconSize( QSize(width, height) ); focusFar1Button->setFlat( flat ); focusFar1Button->setAutoRepeat( true ); focusFar1Button->setAutoRepeatDelay( latency ); focusFar1Button->setAutoRepeatInterval( latency ); /* * Far focus: >> */ QPushButton *focusFar2Button = new QPushButton(); focusFar2Button->setStatusTip( tr("Far focus: medium movement") ); focusFar2Button->setIcon( QIcon(":/Resources/Focus/arrow-right2.png") ); focusFar2Button->setIconSize( QSize(width, height) ); focusFar2Button->setFlat( flat ); focusFar2Button->setAutoRepeat( true ); focusFar2Button->setAutoRepeatDelay( latency ); focusFar2Button->setAutoRepeatInterval( latency ); /* * Far focus: >>> */ QPushButton *focusFar3Button = new QPushButton(); focusFar3Button->setStatusTip( tr("Far focus: large movement") ); focusFar3Button->setIcon( QIcon(":/Resources/Focus/arrow-right3.png") ); focusFar3Button->setIconSize( QSize(width, height) ); focusFar3Button->setFlat( flat ); focusFar3Button->setAutoRepeat( true ); focusFar3Button->setAutoRepeatDelay( latency ); focusFar3Button->setAutoRepeatInterval( latency ); QButtonGroup *focusChosen = new QButtonGroup(); focusChosen->addButton( focusNear3Button, kEdsEvfDriveLens_Near3 ); focusChosen->addButton( focusNear2Button, kEdsEvfDriveLens_Near2 ); focusChosen->addButton( focusNear1Button, kEdsEvfDriveLens_Near1 ); focusChosen->addButton( focusFar1Button, kEdsEvfDriveLens_Far1 ); focusChosen->addButton( focusFar2Button, kEdsEvfDriveLens_Far2 ); focusChosen->addButton( focusFar3Button, kEdsEvfDriveLens_Far3 ); focusChosen->setExclusive( false ); QObject::connect( focusChosen, SIGNAL(buttonClicked(int)), this, SIGNAL(focusAdjustment(int)) ); /* * Final layout. */ QVBoxLayout *focusButtonLayout = new QVBoxLayout(); focusButtonLayout->addStretch( 1 ); focusButtonLayout->addWidget( focusLabel ); focusButtonLayout->addWidget( focusButton ); focusButtonLayout->addStretch( 1 ); QGridLayout *settingsLayout = new QGridLayout(); settingsLayout->addWidget( focusModeLabel, 0, 0 ); settingsLayout->addWidget( focusMode, 1, 0 ); settingsLayout->addWidget( focusModeLiveLabel, 0, 2 ); settingsLayout->addWidget( focusModeLive, 1, 2 ); settingsLayout->addWidget( focusMapLabel, 2, 0 ); settingsLayout->addWidget( focusMapComboBox, 3, 0 ); settingsLayout->addWidget( dofPreviewLabel, 2, 2 ); settingsLayout->addWidget( dofPreviewComboBox, 3, 2 ); settingsLayout->addLayout( focusButtonLayout, 0, 4, 4, 1 ); settingsLayout->setColumnStretch( 1, 1 ); settingsLayout->setColumnStretch( 3, 1 ); QHBoxLayout *focusAdjustmentLayout = new QHBoxLayout(); focusAdjustmentLayout->addWidget( focusNear3Button ); focusAdjustmentLayout->addWidget( focusNear2Button ); focusAdjustmentLayout->addWidget( focusNear1Button ); focusAdjustmentLayout->addWidget( focusFar1Button ); focusAdjustmentLayout->addWidget( focusFar2Button ); focusAdjustmentLayout->addWidget( focusFar3Button ); QVBoxLayout *layout = new QVBoxLayout(); layout->addLayout( settingsLayout ); layout->addWidget( focusAdjustmentLabel ); layout->addLayout( focusAdjustmentLayout ); layout->setContentsMargins( 0, 5, 0, 5 ); return( layout ); }
QBoxLayout * View::exposurePanelLayout() { QLabel *ssLabel = new QLabel( tr("Shutter speed:") ); shutterSpeed = new ShutterSpeed(); QObject::connect( shutterSpeed, SIGNAL(propertyChanged(int,int)), this, SIGNAL(propertyChanged(int,int)) ); QLabel *apertureLabel = new QLabel( tr("Aperture:") ); aperture = new Aperture(); QObject::connect( aperture, SIGNAL(propertyChanged(int,int)), this, SIGNAL(propertyChanged(int,int)) ); QLabel *isoLabel = new QLabel( tr("ISO speed:") ); isoSpeed = new ISOSpeed(); QObject::connect( isoSpeed, SIGNAL(propertyChanged(int,int)), this, SIGNAL(propertyChanged(int,int)) ); shootingMode = new ShootingMode(); QLabel *ecLabel = new QLabel( tr("Exposure compensation:") ); exposureComp = new ExposureComp( camera, 3, this ); QObject::connect( exposureComp, SIGNAL(propertyChanged(int,int)), this, SIGNAL(propertyChanged(int,int))); QLabel *expLabel = new QLabel( tr("Exposure:") ); QToolButton *expButton = new QToolButton(); expButton->setAutoRaise( true ); expButton->setStatusTip( tr("Auto exposure button") ); expButton->setIcon( QIcon(":/Resources/Misc/button.png") ); expButton->setIconSize( QSize(22, 22) ); QObject::connect( expButton, SIGNAL(pressed()), this, SLOT(autoMeteringInitiated()) ); QObject::connect( expButton, SIGNAL(released()), this, SLOT(autoMeteringDiscontinued()) ); QLabel *driveLabel = new QLabel( tr("Drive:") ); driveMode = new DriveMode(); QObject::connect( driveMode, SIGNAL(propertyChanged(int,int)), this, SIGNAL(propertyChanged(int,int)) ); QLabel *meteringLabel = new QLabel( tr("Metering:") ); meteringMode = new MeteringMode(); QObject::connect( meteringMode, SIGNAL(propertyChanged(int,int)), this, SIGNAL(propertyChanged(int,int))); QLabel *whiteLabel = new QLabel( tr("White balance:") ); whiteBalance = new WhiteBalance(); QObject::connect( whiteBalance, SIGNAL(propertyChanged(int,int)), this, SIGNAL(propertyChanged(int,int)) ); QGridLayout *layer1Layout = new QGridLayout(); layer1Layout->addWidget( ssLabel, 0, 0 ); layer1Layout->addWidget( shutterSpeed, 1, 0 ); layer1Layout->addWidget( apertureLabel, 0, 1 ); layer1Layout->addWidget( aperture, 1, 1 ); layer1Layout->addWidget( isoLabel, 0, 2 ); layer1Layout->addWidget( isoSpeed, 1, 2 ); layer1Layout->setColumnStretch( 0, 1 ); layer1Layout->setColumnStretch( 1, 1 ); layer1Layout->setColumnStretch( 2, 1 ); QGridLayout *layer2Layout = new QGridLayout(); layer2Layout->addWidget( shootingMode, 0, 0, 2, 1 ); layer2Layout->addWidget( ecLabel, 0, 2 ); layer2Layout->addWidget( exposureComp, 1, 2 ); layer2Layout->addWidget( expLabel, 0, 4, Qt::AlignHCenter ); layer2Layout->addWidget( expButton, 1, 4, Qt::AlignHCenter | Qt::AlignVCenter ); layer2Layout->setColumnStretch( 1, 1 ); layer2Layout->setColumnStretch( 3, 1 ); QGridLayout *layer3Layout = new QGridLayout(); layer3Layout->addWidget( driveLabel, 0, 0 ); layer3Layout->addWidget( driveMode, 1, 0 ); layer3Layout->addWidget( meteringLabel, 0, 1 ); layer3Layout->addWidget( meteringMode, 1, 1 ); layer3Layout->addWidget( whiteLabel, 0, 2 ); layer3Layout->addWidget( whiteBalance, 1, 2 ); QVBoxLayout *layout = new QVBoxLayout(); layout->addLayout( layer1Layout ); layout->addLayout( layer2Layout ); layout->addLayout( layer3Layout ); layout->setContentsMargins( 0, 5, 0, 5 ); return( layout ); }