// //! [CustomViewerWorkbenchWindowAdvisorPreWindowOpen] // //! [WorkbenchWindowAdvisorCreateWindowContentsHead] void CustomViewerWorkbenchWindowAdvisor::CreateWindowContents(berry::Shell::Pointer shell) { //the all containing main window QMainWindow* mainWindow = static_cast<QMainWindow*>(shell->GetControl()); // //! [WorkbenchWindowAdvisorCreateWindowContentsHead] mainWindow->setVisible(true); //the widgets QWidget* CentralWidget = new QWidget(mainWindow); CentralWidget->setObjectName("CentralWidget"); CentralWidget->setVisible(true); QtPerspectiveSwitcherTabBar* PerspectivesTabBar = new QtPerspectiveSwitcherTabBar(this->GetWindowConfigurer()->GetWindow()); PerspectivesTabBar->setObjectName("PerspectivesTabBar"); PerspectivesTabBar->addTab("Image Viewer"); PerspectivesTabBar->addTab("DICOM-Manager"); PerspectivesTabBar->setVisible(true); PerspectivesTabBar->setDrawBase(false); QPushButton* StyleUpdateButton = new QPushButton("Update Style", mainWindow); StyleUpdateButton->setMaximumWidth(100); StyleUpdateButton->setObjectName("StyleUpdateButton"); QObject::connect(StyleUpdateButton, SIGNAL( clicked() ), this, SLOT( UpdateStyle() )); QToolButton* OpenFileButton = new QToolButton(mainWindow); OpenFileButton->setMaximumWidth(100); OpenFileButton->setObjectName("FileOpenButton"); OpenFileButton->setText("Open File"); QObject::connect(OpenFileButton, SIGNAL( clicked() ), this, SLOT( OpenFile() )); QWidget* PageComposite = new QWidget(CentralWidget); PageComposite->setObjectName("PageComposite"); PageComposite->setVisible(true); //the layouts QVBoxLayout* CentralWidgetLayout = new QVBoxLayout(CentralWidget); CentralWidgetLayout->contentsMargins(); CentralWidgetLayout->setContentsMargins(9,9,9,9); CentralWidgetLayout->setSpacing(0); CentralWidgetLayout->setObjectName("CentralWidgetLayout"); QHBoxLayout* PerspectivesLayer = new QHBoxLayout(mainWindow); PerspectivesLayer->setObjectName("PerspectivesLayer"); QHBoxLayout* PageCompositeLayout = new QHBoxLayout(PageComposite); PageCompositeLayout->setContentsMargins(0,0,0,0); PageCompositeLayout->setSpacing(0); PageComposite->setLayout(PageCompositeLayout); // //! [WorkbenchWindowAdvisorCreateWindowContents] //all glued together mainWindow->setCentralWidget(CentralWidget); CentralWidgetLayout->addLayout(PerspectivesLayer); CentralWidgetLayout->addWidget(PageComposite); CentralWidget->setLayout(CentralWidgetLayout); PerspectivesLayer->addWidget(PerspectivesTabBar); PerspectivesLayer->addSpacing(300); PerspectivesLayer->addWidget(OpenFileButton); //for style customization convenience /*PerspectivesLayer->addSpacing(10); PerspectivesLayer->addWidget(StyleUpdateButton);*/ //for correct initial layout, see also bug#1654 CentralWidgetLayout->activate(); CentralWidgetLayout->update(); this->GetWindowConfigurer()->CreatePageComposite(PageComposite); // //! [WorkbenchWindowAdvisorCreateWindowContents] }
CapNJoinMenu::CapNJoinMenu(QWidget *parent) : QMenu(parent) { QGridLayout *mainLayout = new QGridLayout(); mainLayout->setMargin(2); // The cap group capGroup = new QButtonGroup(this); capGroup->setExclusive(true); QToolButton *button = 0; button = new QToolButton(this); button->setIcon(koIcon("stroke-cap-butt")); button->setCheckable(true); button->setToolTip(i18n("Butt cap")); capGroup->addButton(button, Qt::FlatCap); mainLayout->addWidget(button, 2, 0); button = new QToolButton(this); button->setIcon(koIcon("stroke-cap-round")); button->setCheckable(true); button->setToolTip(i18n("Round cap")); capGroup->addButton(button, Qt::RoundCap); mainLayout->addWidget(button, 2, 1); button = new QToolButton(this); button->setIcon(koIcon("stroke-cap-square")); button->setCheckable(true); button->setToolTip(i18n("Square cap")); capGroup->addButton(button, Qt::SquareCap); mainLayout->addWidget(button, 2, 2, Qt::AlignLeft); // The join group joinGroup = new QButtonGroup(this); joinGroup->setExclusive(true); button = new QToolButton(this); button->setIcon(koIcon("stroke-join-miter")); button->setCheckable(true); button->setToolTip(i18n("Miter join")); joinGroup->addButton(button, Qt::MiterJoin); mainLayout->addWidget(button, 3, 0); button = new QToolButton(this); button->setIcon(koIcon("stroke-join-round")); button->setCheckable(true); button->setToolTip(i18n("Round join")); joinGroup->addButton(button, Qt::RoundJoin); mainLayout->addWidget(button, 3, 1); button = new QToolButton(this); button->setIcon(koIcon("stroke-join-bevel")); button->setCheckable(true); button->setToolTip(i18n("Bevel join")); joinGroup->addButton(button, Qt::BevelJoin); mainLayout->addWidget(button, 3, 2, Qt::AlignLeft); // Miter limit // set min/max/step and value in points, then set actual unit miterLimit = new KoUnitDoubleSpinBox(this); miterLimit->setMinMaxStep(0.0, 1000.0, 0.5); miterLimit->setDecimals(2); miterLimit->setUnit(KoUnit(KoUnit::Point)); miterLimit->setToolTip(i18n("Miter limit")); mainLayout->addWidget(miterLimit, 4, 0, 1, 3); mainLayout->setSizeConstraint(QLayout::SetMinAndMaxSize); setLayout(mainLayout); }
ObjectsController::ObjectsController( Record::Server& server, ObjectsComponent& component ) : server( server ) , component( component ) , view( new ObjectsView( server ) ) , objectReleasing( new QAction( QIcon( ":/icons/trash.png" ) , "&Release", this ) ) , objectRenaming ( new QAction( QIcon( ":/icons/pencil.png" ), "Rena&me" , this ) ) , editorDetaching( new QAction( QIcon( ":/icons/pin.png" ) , "&Detach", this ) ) , pointCreation ( new QAction( "Create &Point", this ) ) , pointerCreation( new QAction( "Create Pointe&r", this ) ) , polylineImport ( new QAction( "Import Poly&line", this ) ) , tempPointCreation( new QAction( "Create Temporary Seed", this ) ) , editorContainer( new QFrame() ) , currentObjectEditor( nullptr ) { editorContainer->setLayout( new QVBoxLayout() ); editorContainer->setContentsMargins( 0, 0, 0, 0 ); editorContainer->setMinimumWidth( 200 ); editorContainer->hide(); QToolBar* const toolBar = new QToolBar(); toolBar->setIconSize( QSize( 24, 24 ) ); toolBar->setToolButtonStyle( Qt::ToolButtonTextUnderIcon ); QToolButton* acquireButton = new QToolButton( toolBar ); QMenu* acquireMenu = new QMenu( acquireButton ); acquireButton->setMenu( acquireMenu ); acquireButton->setPopupMode( QToolButton::InstantPopup ); acquireButton->setToolButtonStyle( Qt::ToolButtonTextUnderIcon ); acquireButton->setText( "Cre&ate" ); acquireButton->setIcon( QIcon( ":/icons/add.png" ) ); acquireMenu->addAction( pointCreation ); acquireMenu->addAction( pointerCreation ); acquireMenu->addSeparator(); acquireMenu->addAction( tempPointCreation ); acquireMenu->addSeparator(); acquireMenu->addAction( polylineImport ); toolBar->addWidget( acquireButton ); toolBar->addAction( objectReleasing ); toolBar->addAction( objectRenaming ); toolBar->addSeparator(); toolBar->addAction( editorDetaching ); connect( pointCreation, SIGNAL( triggered() ), this, SLOT( createPoint3D() ) ); connect( polylineImport, SIGNAL( triggered() ), this, SLOT( importPolyline() ) ); connect( tempPointCreation, SIGNAL( triggered() ), this, SLOT( createTempPoint1() ) ); #ifndef NO_CRA connect( pointerCreation, SIGNAL( triggered() ), this, SLOT( createPointer3D() ) ); #endif this->setMinimumWidth( toolBar->sizeHint().width() ); this->setLayout( new QVBoxLayout() ); this->layout()->addWidget( view ); this->layout()->addWidget( toolBar ); this->layout()->addWidget( editorContainer ); connect( objectReleasing, SIGNAL( triggered() ), this, SLOT( releaseObjects() ) ); connect( objectRenaming , SIGNAL( triggered() ), this, SLOT( renameObject() ) ); connect( editorDetaching, SIGNAL( triggered() ), this, SLOT( detachEditor() ) ); editorDetaching->setEnabled( false ); connect( view, SIGNAL( selectionChanged() ), this, SLOT( objectsSelectionChanged() ) ); connect( view, SIGNAL( objectDoubleClicked( Carna::base::model::Object3D& ) ), this, SLOT( renameObject( Carna::base::model::Object3D& ) ) ); objectsSelectionChanged(); }
/** * Constructor. */ QG_LayerWidget::QG_LayerWidget(QG_ActionHandler* ah, QWidget* parent, const char* name, Qt::WindowFlags f) : QWidget(parent, f) { setObjectName(name); actionHandler = ah; layerList = nullptr; showByBlock = false; lastLayer = nullptr; layerModel = new QG_LayerModel(this); layerView = new QTableView(this); layerView->setModel (layerModel); layerView->setShowGrid (false); layerView->setSelectionMode(QAbstractItemView::SingleSelection); layerView->setEditTriggers(QAbstractItemView::NoEditTriggers); layerView->setFocusPolicy(Qt::NoFocus); layerView->setMinimumHeight(140); layerView->setColumnWidth(QG_LayerModel::VISIBLE, 18); layerView->setColumnWidth(QG_LayerModel::LOCKED, 18); layerView->setColumnWidth(QG_LayerModel::PRINT, 24); layerView->setColumnWidth(QG_LayerModel::CONSTRUCTION, 18); layerView->verticalHeader()->hide(); layerView->horizontalHeader()->setStretchLastSection(true); layerView->horizontalHeader()->hide(); QVBoxLayout* lay = new QVBoxLayout(this); lay->setSpacing ( 0 ); lay->setContentsMargins(2, 2, 2, 2); QHBoxLayout* layButtons = new QHBoxLayout; QToolButton* but; const QSize minButSize(22,22); // show all layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/visiblelayer.png")); but->setMinimumSize(minButSize); but->setToolTip(tr("Show all layers")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersDefreezeAll())); layButtons->addWidget(but); // hide all layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/hiddenlayer.png")); but->setMinimumSize(minButSize); but->setToolTip(tr("Hide all layers")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersFreezeAll())); layButtons->addWidget(but); // add layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/layeradd.png")); but->setMinimumSize(minButSize); but->setToolTip(tr("Add a layer")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersAdd())); layButtons->addWidget(but); // remove layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/layerremove.png")); but->setMinimumSize(minButSize); but->setToolTip(tr("Remove the current layer")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersRemove())); layButtons->addWidget(but); // rename layer: but = new QToolButton(this); but->setIcon(QIcon(":ui/layeredit.png")); but->setMinimumSize(minButSize); but->setToolTip(tr("Modify layer attributes / rename")); connect(but, SIGNAL(clicked()), actionHandler, SLOT(slotLayersEdit())); layButtons->addWidget(but); // lineEdit to filter layer list with RegEx matchLayerName = new QLineEdit(this); matchLayerName->setReadOnly(false); //matchLayerName->setText("*"); matchLayerName->setToolTip(tr("Looking for matching layer names")); connect(matchLayerName, SIGNAL( textChanged(QString) ), this, SLOT( slotUpdateLayerList() ) ); //lay->addWidget(caption); lay->addWidget(matchLayerName); lay->addLayout(layButtons); lay->addWidget(layerView); this->setLayout(lay); connect(layerView, SIGNAL(pressed(QModelIndex)), this, SLOT(slotActivated(QModelIndex))); }
//------------------------------------------------------------------------------------------ void Controller::setupGUI() { //////////////////////////////////////////////////////////////////////////////// // environment textures QGridLayout* envTextureLayout = new QGridLayout; cbEnvTexture = new QComboBox; envTextureLayout->addWidget(cbEnvTexture, 0, 0, 1, 3); cbEnvTexture->addItem("None"); cbEnvTexture->addItem("Sky1"); cbEnvTexture->addItem("Sky2"); cbEnvTexture->addItem("Sky3"); QToolButton* btnPreviousEnvTexture = new QToolButton; btnPreviousEnvTexture->setArrowType(Qt::LeftArrow); envTextureLayout->addWidget(btnPreviousEnvTexture, 0, 3, 1, 1); QToolButton* btnNextEnvTexture = new QToolButton; btnNextEnvTexture->setArrowType(Qt::RightArrow); envTextureLayout->addWidget(btnNextEnvTexture, 0, 4, 1, 1); connect(btnPreviousEnvTexture, SIGNAL(clicked()), this, SLOT(prevEnvTexture())); connect(btnNextEnvTexture, SIGNAL(clicked()), this, SLOT(nextEnvTexture())); QGroupBox* envTextureGroup = new QGroupBox("Background"); envTextureGroup->setLayout(envTextureLayout); //////////////////////////////////////////////////////////////////////////////// // floor textures QGridLayout* floorTextureLayout = new QGridLayout; cbFloorTexture = new QComboBox; floorTextureLayout->addWidget(cbFloorTexture, 0, 0, 1, 3); cbFloorTexture->addItem("None"); cbFloorTexture->addItem("Checkerboard 1"); cbFloorTexture->addItem("Checkerboard 2"); cbFloorTexture->addItem("Stone 1"); cbFloorTexture->addItem("Stone 2"); cbFloorTexture->addItem("Wood 1"); cbFloorTexture->addItem("Wood 2"); QToolButton* btnPreviousFloorTexture = new QToolButton; btnPreviousFloorTexture->setArrowType(Qt::LeftArrow); floorTextureLayout->addWidget(btnPreviousFloorTexture, 0, 3, 1, 1); QToolButton* btnNextFloorTexture = new QToolButton; btnNextFloorTexture->setArrowType(Qt::RightArrow); floorTextureLayout->addWidget(btnNextFloorTexture, 0, 4, 1, 1); connect(btnPreviousFloorTexture, SIGNAL(clicked()), this, SLOT(prevFloorTexture())); connect(btnNextFloorTexture, SIGNAL(clicked()), this, SLOT(nextFloorTexture())); // cbFloorTexture->setCurrentIndex(1); QGroupBox* floorTextureGroup = new QGroupBox("Floor"); floorTextureGroup->setLayout(floorTextureLayout); //////////////////////////////////////////////////////////////////////////////// // frame time sldFrameTime = new QSlider(Qt::Horizontal); sldFrameTime ->setRange(1, 100); sldFrameTime ->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); QSpinBox* spFrameTime = new QSpinBox; spFrameTime->setRange(1, 100); connect(sldFrameTime, &QSlider::valueChanged, spFrameTime, &QSpinBox::setValue); connect(spFrameTime, SIGNAL(valueChanged(int)), sldFrameTime, SLOT(setValue(int))); QGridLayout* frameTimeLayout = new QGridLayout; frameTimeLayout->addWidget(sldFrameTime, 0, 0, 1, 5); frameTimeLayout->addWidget(spFrameTime, 0, 5, 1, 1); QGroupBox* frameTimeGroup = new QGroupBox("Frame Sleep(ms)"); frameTimeGroup->setLayout(frameTimeLayout); /////////////////////////////////////////////////////////////////////////////// // frame stride sldFrameStride = new QSlider(Qt::Horizontal); sldFrameStride ->setRange(1, 100); sldFrameStride ->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); QSpinBox* spFrameStride = new QSpinBox; spFrameStride->setRange(1, 100); connect(sldFrameStride, &QSlider::valueChanged, spFrameStride, &QSpinBox::setValue); connect(spFrameStride, SIGNAL(valueChanged(int)), sldFrameStride, SLOT(setValue(int))); QGridLayout* frameStrideLayout = new QGridLayout; frameStrideLayout->addWidget(sldFrameStride, 0, 0, 1, 5); frameStrideLayout->addWidget(spFrameStride, 0, 5, 1, 1); QGroupBox* frameStrideGroup = new QGroupBox("Frame Stride"); frameStrideGroup->setLayout(frameStrideLayout); //////////////////////////////////////////////////////////////////////////////// /// color modes QRadioButton* rdbColorRandom = new QRadioButton(QString("Random")); QRadioButton* rdbColorRamp = new QRadioButton(QString("Ramp")); QRadioButton* rdbColorParticleType = new QRadioButton(QString("Particle Type")); QRadioButton* rdbColorDensity = new QRadioButton(QString("Density")); QRadioButton* rdbColorStiffness = new QRadioButton(QString("Stiffness")); QRadioButton* rdbColorActivity = new QRadioButton(QString("Activity")); rdbColorParticleType->setChecked(true); QGridLayout* colorModesLayout = new QGridLayout; colorModesLayout->addWidget(rdbColorRandom, 0, 0); colorModesLayout->addWidget(rdbColorRamp, 0, 1); colorModesLayout->addWidget(rdbColorParticleType, 1, 0); colorModesLayout->addWidget(rdbColorDensity, 1, 1); colorModesLayout->addWidget(rdbColorStiffness, 2, 0); colorModesLayout->addWidget(rdbColorActivity, 2, 1); // colorModesLayout->addWidget(rdbColorVelocity, 1, 1); QGroupBox* colorModesGroup = new QGroupBox; colorModesGroup->setTitle(tr("Color Mode")); colorModesGroup->setLayout(colorModesLayout); signalMapperParticleColor = new QSignalMapper(this); connect(rdbColorRandom, SIGNAL(clicked()), signalMapperParticleColor, SLOT(map())); connect(rdbColorRamp, SIGNAL(clicked()), signalMapperParticleColor, SLOT(map())); connect(rdbColorParticleType, SIGNAL(clicked()), signalMapperParticleColor, SLOT(map())); connect(rdbColorDensity, SIGNAL(clicked()), signalMapperParticleColor, SLOT(map())); connect(rdbColorStiffness, SIGNAL(clicked()), signalMapperParticleColor, SLOT(map())); connect(rdbColorActivity, SIGNAL(clicked()), signalMapperParticleColor, SLOT(map())); signalMapperParticleColor->setMapping(rdbColorRandom, (int) COLOR_RANDOM); signalMapperParticleColor->setMapping(rdbColorRamp, (int) COLOR_RAMP); signalMapperParticleColor->setMapping(rdbColorParticleType, (int) COLOR_PARTICLE_TYPE); signalMapperParticleColor->setMapping(rdbColorDensity, (int) COLOR_DENSITY); signalMapperParticleColor->setMapping(rdbColorStiffness, (int) COLOR_STIFFNESS); signalMapperParticleColor->setMapping(rdbColorActivity, (int) COLOR_ACTIVITY); wgSPHParticleColor = new ColorSelector; wgSPHParticleColor->setAutoFillBackground(true); wgSPHParticleColor->setColor(QColor(209, 115, 255)); wgPDParticleColor = new ColorSelector; wgPDParticleColor->setAutoFillBackground(true); wgPDParticleColor->setColor(QColor(107, 255, 128)); QGridLayout* particleColorLayout = new QGridLayout; particleColorLayout->addWidget(new QLabel("SPH Particle:"), 0, 0, Qt::AlignRight); particleColorLayout->addWidget(wgSPHParticleColor, 0, 1, 1, 2); particleColorLayout->addWidget(new QLabel("PD Particle:"), 1, 0, Qt::AlignRight); particleColorLayout->addWidget(wgPDParticleColor, 1, 1, 1, 2); QGroupBox* particleColorGroup = new QGroupBox("Particles' Color"); particleColorGroup->setLayout(particleColorLayout); //////////////////////////////////////////////////////////////////////////////// /// particle viewing modes //////////////////////////////////////////////////////////////////////////////// QRadioButton* rdbPVSphere = new QRadioButton(QString("Sphere")); QRadioButton* rdbPVPoint = new QRadioButton(QString("Point")); QRadioButton* rdbPVOpaqueSurface = new QRadioButton(QString("Surface Only")); QRadioButton* rdbPVTransparentSurface = new QRadioButton(QString("Surface & Texture")); rdbPVSphere->setChecked(true); QGridLayout* pViewingModesLayout = new QGridLayout; pViewingModesLayout->addWidget(rdbPVSphere, 0, 0); pViewingModesLayout->addWidget(rdbPVPoint, 1, 0); pViewingModesLayout->addWidget(rdbPVOpaqueSurface, 0, 1); pViewingModesLayout->addWidget(rdbPVTransparentSurface, 1, 1); QGroupBox* pViewingModesGroup = new QGroupBox; pViewingModesGroup->setTitle(tr("Particle Viewing Mode")); pViewingModesGroup->setLayout(pViewingModesLayout); signalMapperParticleViewing = new QSignalMapper(this); connect(rdbPVSphere, SIGNAL(clicked(bool)), signalMapperParticleViewing, SLOT(map())); connect(rdbPVPoint, SIGNAL(clicked(bool)), signalMapperParticleViewing, SLOT(map())); connect(rdbPVOpaqueSurface, SIGNAL(clicked(bool)), signalMapperParticleViewing, SLOT(map())); connect(rdbPVTransparentSurface, SIGNAL(clicked(bool)), signalMapperParticleViewing, SLOT(map())); signalMapperParticleViewing->setMapping(rdbPVSphere, (int) SPHERES_VIEW); signalMapperParticleViewing->setMapping(rdbPVPoint, (int) POINTS_VIEW); signalMapperParticleViewing->setMapping(rdbPVOpaqueSurface, (int) OPAQUE_SURFACE_VIEW); signalMapperParticleViewing->setMapping(rdbPVTransparentSurface, (int) TRANSPARENT_SURFACE_VIEW); //////////////////////////////////////////////////////////////////////////////// /// simulation info //////////////////////////////////////////////////////////////////////////////// QVBoxLayout* simInfoLayout = new QVBoxLayout; simInfoLayout->setContentsMargins(0, 0, 0, 0); listSimInfo = new QListWidget; // for(int i = 0; i < 100; ++i) // { // listSimInfo->addItem(QString("Item: %1").arg(i)); // } simInfoLayout->addWidget(listSimInfo); QGroupBox* simInfoGroup = new QGroupBox; simInfoGroup->setTitle("Simulation info"); simInfoGroup->setLayout(simInfoLayout); //////////////////////////////////////////////////////////////////////////////// /// buttons //////////////////////////////////////////////////////////////////////////////// btnPause = new QPushButton(QString("Pause")); btnPause->setCheckable(true); btnNextFrame = new QPushButton(QString("Next Frame")); btnReset = new QPushButton(QString("Reset")); btnReverse = new QPushButton(QString("Reverse")); btnReverse->setCheckable(true); btnRepeatPlay = new QPushButton(QString("Repeat")); btnRepeatPlay->setCheckable(true); btnClipYZPlane= new QPushButton(QString("Clip YZ Plane")); btnClipYZPlane->setCheckable(true); btnDualViewport= new QPushButton(QString("Dual Viewport")); btnDualViewport->setCheckable(true); btnHideInvisibleParticles= new QPushButton(QString("Hide Invsb Particles")); btnHideInvisibleParticles->setCheckable(true); //////////////////////////////////////////////////////////////////////////////// /// controls's layout //////////////////////////////////////////////////////////////////////////////// QVBoxLayout* controlLayout = new QVBoxLayout; controlLayout->addWidget(envTextureGroup); controlLayout->addWidget(floorTextureGroup); controlLayout->addWidget(frameTimeGroup); controlLayout->addWidget(frameStrideGroup); controlLayout->addWidget(pViewingModesGroup); controlLayout->addWidget(colorModesGroup); controlLayout->addWidget(particleColorGroup); controlLayout->addWidget(simInfoGroup); controlLayout->addStretch(); controlLayout->addWidget(btnPause); // controlLayout->addWidget(btnNextFrame); controlLayout->addWidget(btnReset); controlLayout->addWidget(btnRepeatPlay); controlLayout->addWidget(btnReverse); controlLayout->addWidget(btnClipYZPlane); controlLayout->addWidget(btnDualViewport); controlLayout->addWidget(btnHideInvisibleParticles); setLayout(controlLayout); setFixedWidth(300); }
//----------------------------------------------------------------------------- MemPanel::MemPanel(QWidget *parent) : QWidget(parent) { QHBoxLayout *h; QVBoxLayout *v; QToolButton *b; infoDlg = new InfoDialog(this); infoDlg->setModal(true); infoDlg->allowRefresh=false; v = new QVBoxLayout(this); h = new QHBoxLayout(); v->addLayout(h); b = new QToolButton(this); b->setIcon(QPixmap(":/png/document-new.png")); b->setToolTip(tr("Create new data array")); h->addWidget(b); connect(b, SIGNAL(clicked()), this, SLOT(newTable())); b = new QToolButton(this); b->setIcon(QPixmap(table_xpm)); b->setToolTip(tr("Edit selected data array")); h->addWidget(b); connect(b, SIGNAL(clicked()), this, SLOT(editData())); b = new QToolButton(this); b->setIcon(QPixmap(":/png/edit-delete.png")); b->setToolTip(tr("Delete selected data array")); h->addWidget(b); connect(b, SIGNAL(clicked()), this, SLOT(delData())); b = new QToolButton(this); b->setIcon(QPixmap(preview_xpm)); b->setToolTip(tr("Properties of selected data array")); h->addWidget(b); connect(b, SIGNAL(clicked()), this, SLOT(infoData())); b = new QToolButton(this); b->setIcon(QPixmap(":/png/view-refresh.png")); b->setToolTip(tr("Update list of data arrays")); h->addWidget(b); connect(b, SIGNAL(clicked()), this, SLOT(refresh())); h->addStretch(1); b = new QToolButton(this); b->setIcon(QPixmap(":/png/edit-clear.png")); b->setToolTip(tr("Delete ALL data arrays")); h->addWidget(b); connect(b, SIGNAL(clicked()), this, SLOT(delAllData())); colSort = 0; tab = new QTableWidget(this); tab->setColumnCount(3); v->addWidget(tab); QStringList sl; sl<<tr("Name")<<tr("Sizes")<<tr("Memory"); tab->setHorizontalHeaderLabels(sl); connect(tab, SIGNAL(cellClicked(int,int)), this, SLOT(tableClicked(int,int))); connect(tab, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(tableDClicked(int,int))); setWindowTitle(tr("Memory")); }
StartupView::StartupView( QWidget * parent ) : QWidget( parent ) { m_templateListModel = boost::shared_ptr<TemplateListModel>( new TemplateListModel() ); setStyleSheet("openstudio--StartupView { background: #E6E6E6; }"); #ifdef Q_WS_MAC setWindowFlags(Qt::FramelessWindowHint); #else setWindowFlags(Qt::CustomizeWindowHint); #endif QWidget * recentProjectsView = new QWidget(); recentProjectsView->setStyleSheet("QWidget { background: #F2F2F2; }"); QVBoxLayout * recentProjectsLayout = new QVBoxLayout(); recentProjectsLayout->setContentsMargins(10,10,10,10); QLabel * recentProjectsLabel = new QLabel("Recent Projects"); recentProjectsLabel->setStyleSheet("QLabel { font: bold }"); recentProjectsLayout->addWidget(recentProjectsLabel,0,Qt::AlignTop); recentProjectsView->setLayout(recentProjectsLayout); QToolButton * openButton = new QToolButton(); openButton->setText("Open File"); openButton->setStyleSheet("QToolButton { font: bold; }"); openButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QIcon openIcon(":/images/open_file.png"); openButton->setIcon(openIcon); openButton->setIconSize(QSize(40,40)); connect( openButton, SIGNAL(clicked()), this, SIGNAL(openClicked()) ); QToolButton * importButton = new QToolButton(); importButton->setText("Import Idf"); importButton->setStyleSheet("QToolButton { font: bold; }"); importButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QIcon importIcon(":/images/import_file.png"); importButton->setIcon(importIcon); importButton->setIconSize(QSize(40,40)); connect( importButton, SIGNAL(clicked()), this, SIGNAL(importClicked()) ); /* QToolButton * importSDDButton = new QToolButton(); importSDDButton->setText("Import SDD"); importSDDButton->setStyleSheet("QToolButton { font: bold; }"); importSDDButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QIcon importSDDIcon(":/images/import_file.png"); importSDDButton->setIcon(importSDDIcon); importSDDButton->setIconSize(QSize(40,40)); connect( importSDDButton, SIGNAL(clicked()), this, SIGNAL(importSDDClicked()) ); */ QWidget * projectChooserView = new QWidget(); projectChooserView->setFixedWidth(238); projectChooserView->setStyleSheet("QWidget { background: #F2F2F2; }"); QVBoxLayout * projectChooserLayout = new QVBoxLayout(); projectChooserLayout->setContentsMargins(10,10,10,10); QLabel * projectChooserLabel = new QLabel("Create New From Template"); projectChooserLabel->setStyleSheet("QLabel { font: bold }"); projectChooserLayout->addWidget(projectChooserLabel,0,Qt::AlignTop); m_listView = new QListView(); m_listView->setViewMode(QListView::IconMode); m_listView->setModel(m_templateListModel.get()); m_listView->setFocusPolicy(Qt::NoFocus); m_listView->setFlow(QListView::LeftToRight); m_listView->setUniformItemSizes(true); m_listView->setSelectionMode(QAbstractItemView::SingleSelection); projectChooserLayout->addWidget(m_listView); projectChooserView->setLayout(projectChooserLayout); m_projectDetailView = new QWidget(); m_projectDetailView->setStyleSheet("QWidget { background: #F2F2F2; }"); QVBoxLayout * projectDetailLayout = new QVBoxLayout(); projectDetailLayout->setContentsMargins(10,10,10,10); m_projectDetailView->setLayout(projectDetailLayout); QWidget * footerView = new QWidget(); footerView->setObjectName("FooterView"); footerView->setStyleSheet("QWidget#FooterView { background: #E6E6E6; }"); footerView->setMaximumHeight(50); footerView->setMinimumHeight(50); QPushButton * cancelButton = new QPushButton(); cancelButton->setObjectName("StandardGrayButton"); cancelButton->setMinimumSize(QSize(99,28)); #ifdef OPENSTUDIO_PLUGIN cancelButton->setText("Cancel"); connect( cancelButton, SIGNAL(clicked()), this, SLOT(hide()) ); #else #ifdef Q_OS_MAC cancelButton->setText("Quit"); #else cancelButton->setText("Exit"); #endif connect( cancelButton, SIGNAL(clicked()), OpenStudioApp::instance(), SLOT(quit()) ); #endif cancelButton->setStyleSheet("QPushButton { font: bold; }"); QPushButton * chooseButton = new QPushButton(); chooseButton->setObjectName("StandardBlueButton"); chooseButton->setText("Choose"); chooseButton->setMinimumSize(QSize(99,28)); connect( chooseButton, SIGNAL(clicked()), this, SLOT(newFromTemplateSlot()) ); chooseButton->setStyleSheet("QPushButton { font: bold; }"); QHBoxLayout * hFooterLayout = new QHBoxLayout(); hFooterLayout->setSpacing(25); hFooterLayout->setContentsMargins(0,0,0,0); hFooterLayout->addStretch(); hFooterLayout->addWidget(cancelButton); hFooterLayout->addWidget(chooseButton); footerView->setLayout(hFooterLayout); QHBoxLayout * hLayout = new QHBoxLayout(); QVBoxLayout * vLayout = new QVBoxLayout(); QVBoxLayout * vOpenLayout = new QVBoxLayout(); vOpenLayout->addWidget(recentProjectsView); vOpenLayout->addWidget(openButton); vOpenLayout->addWidget(importButton); //vOpenLayout->addWidget(importSDDButton); hLayout->addLayout(vOpenLayout); hLayout->addWidget(projectChooserView); hLayout->addWidget(m_projectDetailView,1); vLayout->addSpacing(50); vLayout->addLayout(hLayout); vLayout->addWidget(footerView); setLayout(vLayout); connect(m_listView,SIGNAL(clicked( const QModelIndex &)),this,SLOT( showDetailsForItem( const QModelIndex & ) )); m_listView->setCurrentIndex(m_templateListModel->index(0,0)); showDetailsForItem(m_templateListModel->index(0,0)); }
QbsRunConfigurationWidget::QbsRunConfigurationWidget(QbsRunConfiguration *rc, QWidget *parent) : QWidget(parent), m_rc(rc), m_ignoreChange(false), m_isShown(false) { QVBoxLayout *vboxTopLayout = new QVBoxLayout(this); vboxTopLayout->setMargin(0); QHBoxLayout *hl = new QHBoxLayout(); hl->addStretch(); m_disabledIcon = new QLabel(this); m_disabledIcon->setPixmap(QPixmap(QLatin1String(":/projectexplorer/images/compile_warning.png"))); hl->addWidget(m_disabledIcon); m_disabledReason = new QLabel(this); m_disabledReason->setVisible(false); hl->addWidget(m_disabledReason); hl->addStretch(); vboxTopLayout->addLayout(hl); m_detailsContainer = new Utils::DetailsWidget(this); m_detailsContainer->setState(Utils::DetailsWidget::NoSummary); vboxTopLayout->addWidget(m_detailsContainer); QWidget *detailsWidget = new QWidget(m_detailsContainer); m_detailsContainer->setWidget(detailsWidget); QFormLayout *toplayout = new QFormLayout(detailsWidget); toplayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); toplayout->setMargin(0); m_executableLineEdit = new QLineEdit(this); m_executableLineEdit->setEnabled(false); m_executableLineEdit->setPlaceholderText(tr("<unknown>")); toplayout->addRow(tr("Executable:"), m_executableLineEdit); QLabel *argumentsLabel = new QLabel(tr("Arguments:"), this); m_argumentsLineEdit = new QLineEdit(m_rc->rawCommandLineArguments(), this); argumentsLabel->setBuddy(m_argumentsLineEdit); toplayout->addRow(argumentsLabel, m_argumentsLineEdit); m_workingDirectoryEdit = new Utils::PathChooser(this); m_workingDirectoryEdit->setHistoryCompleter(QLatin1String("Qbs.WorkingDir.History")); m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory); ProjectExplorer::EnvironmentAspect *aspect = m_rc->extraAspect<ProjectExplorer::EnvironmentAspect>(); if (aspect) { connect(aspect, SIGNAL(environmentChanged()), this, SLOT(environmentWasChanged())); environmentWasChanged(); } m_workingDirectoryEdit->setPromptDialogTitle(tr("Select Working Directory")); QToolButton *resetButton = new QToolButton(this); resetButton->setToolTip(tr("Reset to default")); resetButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_RESET))); QHBoxLayout *boxlayout = new QHBoxLayout(); boxlayout->setMargin(0); boxlayout->addWidget(m_workingDirectoryEdit); boxlayout->addWidget(resetButton); toplayout->addRow(tr("Working directory:"), boxlayout); QHBoxLayout *innerBox = new QHBoxLayout(); m_useTerminalCheck = new QCheckBox(tr("Run in terminal"), this); innerBox->addWidget(m_useTerminalCheck); innerBox->addStretch(); toplayout->addRow(QString(), innerBox); runConfigurationEnabledChange(); connect(m_workingDirectoryEdit, SIGNAL(changed(QString)), this, SLOT(workDirectoryEdited())); connect(resetButton, SIGNAL(clicked()), this, SLOT(workingDirectoryWasReset())); connect(m_argumentsLineEdit, SIGNAL(textEdited(QString)), this, SLOT(argumentsEdited(QString))); connect(m_useTerminalCheck, SIGNAL(toggled(bool)), this, SLOT(termToggled(bool))); connect(m_rc, SIGNAL(baseWorkingDirectoryChanged(QString)), this, SLOT(workingDirectoryChanged(QString))); connect(m_rc, SIGNAL(commandLineArgumentsChanged(QString)), this, SLOT(commandLineArgumentsChanged(QString))); connect(m_rc, SIGNAL(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode)), this, SLOT(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode))); connect(m_rc, SIGNAL(targetInformationChanged()), this, SLOT(targetInformationHasChanged()), Qt::QueuedConnection); connect(m_rc, SIGNAL(enabledChanged()), this, SLOT(runConfigurationEnabledChange())); }
QWidget* GCF::ActionContainerWidget::createWidget(QAction* action, int rowSpan, int colSpan) { QWidget* ret = 0; int gSize=int((fontMetrics().height()+fontMetrics().ascent())*1.2); int minWidth = gSize*colSpan; QWidgetAction* wAction = qobject_cast<QWidgetAction*>(action); if(wAction) ret = wAction->requestWidget(this); else { QToolButton* tb = new QToolButton(this); tb->setDefaultAction(action); tb->setAutoRaise(true); /*if(action->menu()) tb->setMenu(action->menu());*/ tb->setIconSize(QSize(gSize-4,gSize-4)); if(action->icon().isNull()) tb->setToolButtonStyle(Qt::ToolButtonTextOnly); else if(colSpan == rowSpan && colSpan >= 2) tb->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); else if(colSpan == rowSpan && colSpan == 1) tb->setToolButtonStyle(Qt::ToolButtonIconOnly); else if(colSpan >= 2 || rowSpan == 1) tb->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); else if(rowSpan >= 3) tb->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); int mw = 0; if(tb->toolButtonStyle() != Qt::ToolButtonIconOnly) mw += fontMetrics().width(action->iconText())+2*fontMetrics().width("_"); if(!action->icon().isNull()) { switch(tb->toolButtonStyle()) { case Qt::ToolButtonTextUnderIcon: if(mw < gSize-4) mw = gSize-4; break; case Qt::ToolButtonTextBesideIcon: mw += gSize-4; break; } } if(minWidth < mw) minWidth = mw; if(action->menu()) { // Connect the default action object to the tool button. This way // when the toolbutton with menu is clicked, the default action is // shown. QList<QAction*> actions = action->menu()->actions(); QAction* defAction = 0; for(int i=0; i<actions.count(); i++) { QAction* action = actions[i]; QList<QByteArray> propNames = action->dynamicPropertyNames(); if(propNames.contains("_default_")) { bool val = action->property("_default_").toBool(); if(val) { defAction = action; break; } } } if(defAction) { if(defAction->isCheckable()) connect(tb, SIGNAL(clicked()), defAction, SLOT(toggle())); else connect(tb, SIGNAL(clicked()), defAction, SLOT(trigger())); QFont font = defAction->font(); font.setBold(true); defAction->setFont(font); } } ret = tb; } ret->setMinimumSize(minWidth, gSize*rowSpan); if(!action->icon().isNull()) { QFont font = ret->font(); // font.setPointSize(font.pointSize()-1); ret->setFont(font); } /*static QPlastiqueStyle Style; ret->setStyle(&Style);*/ return ret; }
bool QgsCustomizationDialog::switchWidget( QWidget *widget, QMouseEvent *e ) { Q_UNUSED( e ); QgsDebugMsg( "Entered" ); if ( !actionCatch->isChecked() ) return false; QString path = widgetPath( widget ); QgsDebugMsg( "path = " + path ); if ( path.startsWith( "/QgsCustomizationDialogBase" ) ) { // do not allow modification of this dialog return false; } else if ( path.startsWith( "/QgisApp" ) ) { // changes to main window // (work with toolbars, tool buttons) if ( widget->inherits( "QToolBar" ) ) { path = "/Toolbars/" + widget->objectName(); } else if ( widget->inherits( "QToolButton" ) ) { QToolButton* toolbutton = qobject_cast<QToolButton*>( widget ); QAction* action = toolbutton->defaultAction(); if ( !action ) return false; QString toolbarName = widget->parent()->objectName(); QString actionName = action->objectName(); path = "/Toolbars/" + toolbarName + "/" + actionName; } else { // unsupported widget in main window return false; } } else { // ordinary widget in a dialog path = "/Widgets" + path; } QgsDebugMsg( "path final = " + path ); bool on = !itemChecked( path ); QgsDebugMsg( QString( "on = %1" ).arg( on ) ); setItemChecked( path, on ); QTreeWidgetItem *myItem = item( path ); if ( myItem ) { treeWidget->scrollToItem( myItem, QAbstractItemView::PositionAtCenter ); treeWidget->clearSelection(); myItem->setSelected( true ); QString style; if ( !on ) { style = "background-color: #FFCCCC;"; } widget->setStyleSheet( style ); } return true; }
TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerInfo_User *_ownUser, const ServerInfo_Room &info) : Tab(_tabSupervisor), client(_client), roomId(info.room_id()), roomName(QString::fromStdString(info.name())), ownUser(_ownUser) { const int gameTypeListSize = info.gametype_list_size(); for (int i = 0; i < gameTypeListSize; ++i) gameTypes.insert(info.gametype_list(i).game_type_id(), QString::fromStdString(info.gametype_list(i).description())); QMap<int, GameTypeMap> tempMap; tempMap.insert(info.room_id(), gameTypes); gameSelector = new GameSelector(client, tabSupervisor, this, QMap<int, QString>(), tempMap, true, true); userList = new UserList(tabSupervisor, client, UserList::RoomList); connect(userList, SIGNAL(openMessageDialog(const QString &, bool)), this, SIGNAL(openMessageDialog(const QString &, bool))); chatView = new ChatView(tabSupervisor, 0, true); connect(chatView, SIGNAL(showMentionPopup(QString&)), this, SLOT(actShowMentionPopup(QString&))); connect(chatView, SIGNAL(messageClickedSignal()), this, SLOT(focusTab())); connect(chatView, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool))); connect(chatView, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString))); connect(chatView, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString))); connect(chatView, SIGNAL(addMentionTag(QString)), this, SLOT(addMentionTag(QString))); connect(settingsCache, SIGNAL(chatMentionCompleterChanged()), this, SLOT(actCompleterChanged())); sayLabel = new QLabel; sayEdit = new LineEditCompleter; sayLabel->setBuddy(sayEdit); connect(sayEdit, SIGNAL(returnPressed()), this, SLOT(sendMessage())); QMenu *chatSettingsMenu = new QMenu(this); aClearChat = chatSettingsMenu->addAction(QString()); connect(aClearChat, SIGNAL(triggered()), this, SLOT(actClearChat())); chatSettingsMenu->addSeparator(); aOpenChatSettings = chatSettingsMenu->addAction(QString()); connect(aOpenChatSettings, SIGNAL(triggered()), this, SLOT(actOpenChatSettings())); QToolButton *chatSettingsButton = new QToolButton; chatSettingsButton->setIcon(QPixmap("theme:icons/settings")); chatSettingsButton->setMenu(chatSettingsMenu); chatSettingsButton->setPopupMode(QToolButton::InstantPopup); QHBoxLayout *sayHbox = new QHBoxLayout; sayHbox->addWidget(sayLabel); sayHbox->addWidget(sayEdit); sayHbox->addWidget(chatSettingsButton); QVBoxLayout *chatVbox = new QVBoxLayout; chatVbox->addWidget(chatView); chatVbox->addLayout(sayHbox); chatGroupBox = new QGroupBox; chatGroupBox->setLayout(chatVbox); QSplitter *splitter = new QSplitter(Qt::Vertical); splitter->addWidget(gameSelector); splitter->addWidget(chatGroupBox); QHBoxLayout *hbox = new QHBoxLayout; hbox->addWidget(splitter, 3); hbox->addWidget(userList, 1); aLeaveRoom = new QAction(this); connect(aLeaveRoom, SIGNAL(triggered()), this, SLOT(actLeaveRoom())); roomMenu = new QMenu(this); roomMenu->addAction(aLeaveRoom); addTabMenu(roomMenu); const int userListSize = info.user_list_size(); for (int i = 0; i < userListSize; ++i){ userList->processUserInfo(info.user_list(i), true); autocompleteUserList.append("@" + QString::fromStdString(info.user_list(i).name())); } userList->sortItems(); const int gameListSize = info.game_list_size(); for (int i = 0; i < gameListSize; ++i) gameSelector->processGameInfo(info.game_list(i)); completer = new QCompleter(autocompleteUserList, sayEdit); completer->setCaseSensitivity(Qt::CaseInsensitive); completer->setMaxVisibleItems(5); #if QT_VERSION >= 0x050000 completer->setFilterMode(Qt::MatchStartsWith); #endif sayEdit->setCompleter(completer); actCompleterChanged(); connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts())); refreshShortcuts(); retranslateUi(); QWidget * mainWidget = new QWidget(this); mainWidget->setLayout(hbox); setCentralWidget(mainWidget); }
VESPERSSampleStageView::VESPERSSampleStageView(VESPERSSampleStageControl *sampleStage, QWidget *parent) : QWidget(parent) { sampleStage_ = sampleStage; connect(sampleStage_, SIGNAL(connected(bool)), this, SLOT(setEnabled(bool))); connect(sampleStage_, SIGNAL(movingChanged(bool)), this, SLOT(onMovingChanged(bool))); connect(sampleStage_, SIGNAL(horizontalMoveError(bool)), this, SLOT(onHorizontalMoveError(bool))); connect(sampleStage_, SIGNAL(verticalMoveError(bool)), this, SLOT(onVerticalMoveError(bool))); connect(sampleStage_, SIGNAL(normalMoveError(bool)), this, SLOT(onNormalMoveError(bool))); invertHorizontal_ = false; invertVertical_ = false; QFont font(this->font()); font.setBold(true); title_ = ""; horizontalTitle_ = "H"; verticalTitle_ = "V"; titleLabel_ = new QLabel("Sample Stage"); titleLabel_->setFont(font); horizontalLabel_ = new QLabel("H :"); horizontalLabel_->setFont(font); verticalLabel_ = new QLabel("V :"); verticalLabel_->setFont(font); QLabel *jog = new QLabel("Jog :"); jog->setFont(font); jog_ = new QDoubleSpinBox; jog_->setSuffix(" mm"); jog_->setSingleStep(0.001); jog_->setMaximum(5.0); jog_->setMinimum(0.0000); jog_->setValue(0.050); jog_->setDecimals(3); jog_->setAlignment(Qt::AlignCenter); jog_->setFixedWidth(110); QHBoxLayout *jogLayout = new QHBoxLayout; jogLayout->addWidget(jog, 0, Qt::AlignRight); jogLayout->addWidget(jog_); horizontal_ = new QDoubleSpinBox; horizontal_->setSuffix(" mm"); horizontal_->setSingleStep(0.001); horizontal_->setRange(-100, 100); horizontal_->setDecimals(3); horizontal_->setAlignment(Qt::AlignCenter); horizontal_->setFixedWidth(110); connect(horizontal_, SIGNAL(editingFinished()), this, SLOT(onHorizontalSetpoint())); connect(sampleStage_, SIGNAL(horizontalSetpointChanged(double)), horizontal_, SLOT(setValue(double))); QHBoxLayout *hLayout = new QHBoxLayout; hLayout->addWidget(horizontalLabel_, 0, Qt::AlignRight); hLayout->addWidget(horizontal_); vertical_ = new QDoubleSpinBox; vertical_->setSuffix(" mm"); vertical_->setSingleStep(0.001); vertical_->setRange(-100, 100); vertical_->setDecimals(3); vertical_->setAlignment(Qt::AlignCenter); vertical_->setFixedWidth(110); connect(vertical_, SIGNAL(editingFinished()), this, SLOT(onVerticalSetpoint())); connect(sampleStage_, SIGNAL(verticalSetpointChanged(double)), vertical_, SLOT(setValue(double))); QHBoxLayout *vLayout = new QHBoxLayout; vLayout->addWidget(verticalLabel_, 0, Qt::AlignRight); vLayout->addWidget(vertical_); status_ = new QLabel; status_->setPixmap(QIcon(":/OFF.png").pixmap(25)); goUp_ = new QToolButton; goUp_->setIcon(QIcon(":/go-up.png")); connect(goUp_, SIGNAL(clicked()), this, SLOT(onUpClicked())); goDown_ = new QToolButton; goDown_->setIcon(QIcon(":/go-down.png")); connect(goDown_, SIGNAL(clicked()), this, SLOT(onDownClicked())); goLeft_ = new QToolButton; goLeft_->setIcon(QIcon(":/go-previous.png")); connect(goLeft_, SIGNAL(clicked()), this, SLOT(onLeftClicked())); goRight_ = new QToolButton; goRight_->setIcon(QIcon(":/go-next.png")); connect(goRight_, SIGNAL(clicked()), this, SLOT(onRightClicked())); buttons_ = new QButtonGroup(this); buttons_->addButton(goUp_, 0); buttons_->addButton(goDown_, 1); buttons_->addButton(goLeft_, 2); buttons_->addButton(goRight_, 3); QToolButton *stop = new QToolButton; stop->setIcon(QIcon(":/stop.png")); connect(stop, SIGNAL(clicked()), sampleStage_, SLOT(stopAll())); QGridLayout *arrowLayout = new QGridLayout; arrowLayout->addWidget(goUp_, 0, 1); arrowLayout->addWidget(goDown_, 2, 1); arrowLayout->addWidget(goLeft_, 1, 0); arrowLayout->addWidget(goRight_, 1, 2); arrowLayout->addWidget(stop, 1, 1); arrowLayout->addWidget(status_, 0, 0); QVBoxLayout *absoluteValueLayout = new QVBoxLayout; absoluteValueLayout->addLayout(hLayout); absoluteValueLayout->addLayout(vLayout); absoluteValueLayout->addLayout(jogLayout); QHBoxLayout *sampleStageLayout = new QHBoxLayout; sampleStageLayout->addLayout(arrowLayout); sampleStageLayout->addLayout(absoluteValueLayout); QVBoxLayout *fullLayout = new QVBoxLayout; fullLayout->addWidget(titleLabel_); fullLayout->addLayout(sampleStageLayout); setLayout(fullLayout); }
ContractForm::ContractForm(QString id, QWidget *parent, bool onlyForRead) : QDialog(parent) { indexTemp = id; QFile file(":/ToolButtonStyle.txt"); file.open(QFile::ReadOnly); QString styleSheetString = QLatin1String(file.readAll()); labelNumber = new QLabel(trUtf8("Number:")); editNumber = new LineEdit; editNumber->setReadOnly(onlyForRead); labelNumber->setBuddy(editNumber); labelDate = new QLabel(trUtf8("Date:")); editDate = new QDateEdit; editDate->setCalendarPopup(true); editDate->setReadOnly(onlyForRead); editDate->setDate(QDate::currentDate()); labelEmployee = new QLabel(trUtf8("FIO:")); editEmployee = new LineEdit; editEmployee->setReadOnly(onlyForRead); labelEmployee->setBuddy(editEmployee); QSqlQueryModel *employeeModel = new QSqlQueryModel; employeeModel->setQuery("SELECT employeename FROM employee"); QCompleter *employeeCompleter = new QCompleter(employeeModel); employeeCompleter->setCompletionMode(QCompleter::PopupCompletion); employeeCompleter->setCaseSensitivity(Qt::CaseSensitive); editEmployee->setCompleter(employeeCompleter); QToolButton *addButton = new QToolButton; QPixmap addPix(":/add.png"); addButton->setIcon(addPix); addButton->setToolTip(trUtf8("Add new record")); connect(addButton,SIGNAL(clicked()),this,SLOT(addRecord())); addButton->setStyleSheet(styleSheetString); QToolButton *seeButton = new QToolButton; QPixmap seePix(":/see.png"); seeButton->setIcon(seePix); seeButton->setToolTip(trUtf8("See select item")); connect(seeButton,SIGNAL(clicked()),this,SLOT(seeRecord())); seeButton->setStyleSheet(styleSheetString); QToolButton *listButton = new QToolButton; QPixmap listPix(":/list.png"); listButton->setIcon(listPix); listButton->setToolTip(trUtf8("See list of item")); connect(listButton,SIGNAL(clicked()),this,SLOT(listRecord())); listButton->setStyleSheet(styleSheetString); QHBoxLayout *editLayout = new QHBoxLayout; editLayout->addWidget(labelEmployee); editLayout->addWidget(editEmployee); if(!onlyForRead){ editLayout->addWidget(addButton); editLayout->addWidget(seeButton); editLayout->addWidget(listButton); } savePushButton = new QPushButton(trUtf8("Save")); connect(savePushButton,SIGNAL(clicked()),this,SLOT(editRecord())); savePushButton->setToolTip(trUtf8("Save And Close Button")); cancelPushButton = new QPushButton(trUtf8("Cancel")); cancelPushButton->setDefault(true); cancelPushButton->setStyleSheet("QPushButton:hover {color: red}"); connect(cancelPushButton,SIGNAL(clicked()),this,SLOT(accept())); cancelPushButton->setToolTip(trUtf8("Cancel Button")); printPushButton = new QPushButton(trUtf8("Print")); //connect(savePushButton,SIGNAL(clicked()),this,SLOT(editRecord())); printPushButton->setToolTip(trUtf8("Print Contract Button")); buttonBox = new QDialogButtonBox; buttonBox->addButton(printPushButton,QDialogButtonBox::ActionRole); buttonBox->addButton(cancelPushButton,QDialogButtonBox::ActionRole); buttonBox->addButton(savePushButton,QDialogButtonBox::ActionRole); if(indexTemp != ""){ QSqlQuery query; query.prepare("SELECT organizationname FROM organization WHERE organizationid = ?"); query.addBindValue(indexTemp); query.exec(); while(query.next()){ //editOrganization->setText(query.value(0).toString()); } }else{ //editOrganization->clear(); } QGridLayout *mainLayout = new QGridLayout; mainLayout->addWidget(labelNumber,0,0); mainLayout->addWidget(editNumber,0,1); mainLayout->addWidget(labelDate,0,2); mainLayout->addWidget(editDate,0,3); mainLayout->addLayout(editLayout,1,0,1,3); if(!onlyForRead){ mainLayout->addWidget(buttonBox,2,3); //editOrganization->selectAll(); } setLayout(mainLayout); setWindowTitle(trUtf8("Organization")); }
FindDocWidget::FindDocWidget(LiteApi::IApplication *app, QWidget *parent) : QWidget(parent), m_liteApp(app) { m_findEdit = new SearchEdit; m_findEdit->setPlaceholderText(tr("Search")); m_chaseWidget = new ChaseWidget; m_chaseWidget->setMinimumSize(QSize(16,16)); m_chaseWidget->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); QToolButton *findBtn = new QToolButton; findBtn->setPopupMode(QToolButton::InstantPopup); findBtn->setText(tr("Find")); QHBoxLayout *findLayout = new QHBoxLayout; findLayout->setMargin(2); findLayout->addWidget(m_findEdit); findLayout->addWidget(findBtn); findLayout->addWidget(m_chaseWidget); m_browser = m_liteApp->htmlWidgetManager()->createByName(this,"QTextBrowser"); QStringList paths; paths << m_liteApp->resourcePath()+"/packages/go/godoc"; m_browser->setSearchPaths(paths); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->setMargin(1); mainLayout->setSpacing(1); mainLayout->addLayout(findLayout); mainLayout->addWidget(m_browser->widget()); QAction *findAll = new QAction(tr("Find All"),this); QAction *findConst = new QAction(tr("Find const"),this); findConst->setData("const"); QAction *findFunc = new QAction(tr("Find func"),this); findFunc->setData("func"); QAction *findInterface = new QAction(tr("Find interface"),this); findInterface->setData("interface"); QAction *findPkg = new QAction(tr("Find pkg"),this); findPkg->setData("pkg"); QAction *findStruct = new QAction(tr("Find struct"),this); findStruct->setData("struct"); QAction *findType = new QAction(tr("Find type"),this); findType->setData("type"); QAction *findVar = new QAction(tr("Find var"),this); findVar->setData("var"); m_useRegexpCheckAct = new QAction(tr("Use Regexp"),this); m_useRegexpCheckAct->setCheckable(true); m_matchCaseCheckAct = new QAction(tr("Match Case"),this); m_matchCaseCheckAct->setCheckable(true); m_matchWordCheckAct = new QAction(tr("Match Word"),this); m_matchWordCheckAct->setCheckable(true); m_useRegexpCheckAct->setChecked(m_liteApp->settings()->value(GODOCFIND_USEREGEXP,false).toBool()); m_matchCaseCheckAct->setChecked(m_liteApp->settings()->value(GODOCFIND_MATCHCASE,true).toBool()); m_matchWordCheckAct->setChecked(m_liteApp->settings()->value(GODOCFIND_MATCHWORD,false).toBool()); QMenu *menu = new QMenu(findBtn); menu->addActions(QList<QAction*>() << findAll //<< findPkg ); menu->addSeparator(); menu->addActions(QList<QAction*>() << findInterface << findStruct << findType << findFunc << findConst << findVar ); menu->addSeparator(); menu->addAction(m_matchWordCheckAct); menu->addAction(m_matchCaseCheckAct); menu->addAction(m_useRegexpCheckAct); findBtn->setMenu(menu); QAction *helpAct = new QAction(tr("Help"),this); menu->addSeparator(); menu->addAction(helpAct); connect(helpAct,SIGNAL(triggered()),this,SLOT(showHelp())); this->setLayout(mainLayout); connect(findAll,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findConst,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findFunc,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findInterface,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findPkg,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findStruct,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findType,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findVar,SIGNAL(triggered()),this,SLOT(findDoc())); m_process = new ProcessEx(this); connect(m_process,SIGNAL(stateChanged(QProcess::ProcessState)),this,SLOT(stateChanged(QProcess::ProcessState))); connect(m_process,SIGNAL(extOutput(QByteArray,bool)),this,SLOT(extOutput(QByteArray,bool))); connect(m_process,SIGNAL(extFinish(bool,int,QString)),this,SLOT(extFinish(bool,int,QString))); connect(m_findEdit,SIGNAL(returnPressed()),findAll,SIGNAL(triggered())); connect(m_findEdit,SIGNAL(rightButtonClicked()),this,SLOT(abortFind())); connect(m_browser,SIGNAL(linkClicked(QUrl)),this,SLOT(openUrl(QUrl))); QString path = m_liteApp->resourcePath()+"/packages/go/godoc/finddoc.html"; QFile file(path); if (file.open(QIODevice::ReadOnly)) { m_templateData = file.readAll(); file.close(); } //QFont font = m_browser->widget()->font(); //font.setPointSize(12); //m_browser->widget()->setFont(font); showHelp(); }
void QmitkToolSelectionBox::SetOrUnsetButtonForActiveTool() { // we want to emit a signal in any case, whether we selected ourselves or somebody else changes "our" tool manager. --> emit before check on m_SelfCall int id = m_ToolManager->GetActiveToolID(); // don't emit signal for shape model tools bool emitSignal = true; mitk::Tool* tool = m_ToolManager->GetActiveTool(); if(tool && std::string(tool->GetGroup()) == "organ_segmentation") emitSignal = false; if(emitSignal) emit ToolSelected(id); // delete old GUI (if any) if ( m_LastToolGUI && m_ToolGUIWidget ) { if (m_ToolGUIWidget->layout()) { m_ToolGUIWidget->layout()->removeWidget(m_LastToolGUI); } //m_LastToolGUI->reparent(NULL, QPoint(0,0)); // TODO: reparent <-> setParent, Daniel fragen m_LastToolGUI->setParent(0); delete m_LastToolGUI; // will hopefully notify parent and layouts m_LastToolGUI = NULL; QLayout* layout = m_ToolGUIWidget->layout(); if (layout) { layout->activate(); } } QToolButton* toolButton(NULL); //mitk::Tool* tool = m_ToolManager->GetActiveTool(); if (m_ButtonIDForToolID.find(id) != m_ButtonIDForToolID.end()) // if this tool is in our box { //toolButton = dynamic_cast<QToolButton*>( Q3ButtonGroup::find( m_ButtonIDForToolID[id] ) ); toolButton = dynamic_cast<QToolButton*>( m_ToolButtonGroup->buttons().at( m_ButtonIDForToolID[id] ) ); } if ( toolButton ) { // mmueller // uncheck all other buttons QAbstractButton* tmpBtn = 0; QList<QAbstractButton*>::iterator it; for(int i=0; i < m_ToolButtonGroup->buttons().size(); ++i) { tmpBtn = m_ToolButtonGroup->buttons().at(i); if(tmpBtn != toolButton) dynamic_cast<QToolButton*>( tmpBtn )->setChecked(false); } toolButton->setChecked(true); if (m_ToolGUIWidget && tool) { // create and reparent new GUI (if any) itk::Object::Pointer possibleGUI = tool->GetGUI("Qmitk", "GUI").GetPointer(); // prefix and postfix QmitkToolGUI* gui = dynamic_cast<QmitkToolGUI*>( possibleGUI.GetPointer() ); //! m_LastToolGUI = gui; if (gui) { gui->SetTool( tool ); // mmueller //gui->reparent(m_ToolGUIWidget, gui->geometry().topLeft(), true ); gui->setParent(m_ToolGUIWidget); gui->move(gui->geometry().topLeft()); gui->show(); QLayout* layout = m_ToolGUIWidget->layout(); if (!layout) { layout = new QVBoxLayout( m_ToolGUIWidget ); } if (layout) { // mmueller layout->addWidget( gui ); //layout->add( gui ); layout->activate(); } } } } else { // disable all buttons QToolButton* selectedToolButton = dynamic_cast<QToolButton*>( m_ToolButtonGroup->checkedButton() ); //QToolButton* selectedToolButton = dynamic_cast<QToolButton*>( Q3ButtonGroup::find( Q3ButtonGroup::selectedId() ) ); if (selectedToolButton) { // mmueller selectedToolButton->setChecked(false); //selectedToolButton->setOn(false); } } }
void MusicSystemTrayMenu::createPlayWidgetActions() { m_widgetAction = new QWidgetAction(this); QWidget *widgetActionContainer = new QWidget(this); QVBoxLayout *vbox = new QVBoxLayout(widgetActionContainer); vbox->setMargin(0); QWidget *widgetContainer = new QWidget(widgetActionContainer); QHBoxLayout *box = new QHBoxLayout(widgetContainer); box->setMargin(0); QToolButton *previousPlay = new QToolButton(widgetContainer); QToolButton *nextPlay = new QToolButton(widgetContainer); m_PlayOrStop = new QToolButton(widgetContainer); previousPlay->setIcon(QIcon(QString::fromUtf8(":/contextMenu/sysprevious"))); nextPlay->setIcon(QIcon(QString::fromUtf8(":/contextMenu/sysnext"))); m_PlayOrStop->setIcon(QIcon(QString::fromUtf8(":/contextMenu/sysplay"))); previousPlay->setIconSize(QSize(40, 40)); nextPlay->setIconSize(QSize(40, 40)); m_PlayOrStop->setIconSize(QSize(45, 45)); previousPlay->setStyleSheet(MusicUIObject::MToolButtonStyle01); nextPlay->setStyleSheet(MusicUIObject::MToolButtonStyle01); m_PlayOrStop->setStyleSheet(MusicUIObject::MToolButtonStyle01); previousPlay->setCursor(QCursor(Qt::PointingHandCursor)); nextPlay->setCursor(QCursor(Qt::PointingHandCursor)); m_PlayOrStop->setCursor(QCursor(Qt::PointingHandCursor)); previousPlay->setToolTip(tr("Previous")); nextPlay->setToolTip(tr("Next")); m_PlayOrStop->setToolTip(tr("Play")); box->addWidget(previousPlay); box->addWidget(m_PlayOrStop); box->addWidget(nextPlay); m_showText = new QLabel(widgetActionContainer); m_showText->setAlignment(Qt::AlignCenter); m_showText->setStyleSheet(MusicUIObject::MCustomStyle12); vbox->addWidget(widgetContainer); vbox->addWidget(m_showText); widgetActionContainer->setLayout(vbox); m_widgetAction->setDefaultWidget(widgetActionContainer); connect(previousPlay, SIGNAL(clicked()), parent(), SLOT(musicPlayPrevious())); connect(nextPlay, SIGNAL(clicked()), parent(), SLOT(musicPlayNext())); connect(m_PlayOrStop, SIGNAL(clicked()), parent(), SLOT(musicStatePlay())); }
void QmitkToolSelectionBox::RecreateButtons() { if (m_ToolManager.IsNull()) return; /* // remove all buttons that are there QObjectList *l = Q3ButtonGroup::queryList( "QButton" ); QObjectListIt it( *l ); // iterate over all buttons QObject *obj; while ( (obj = it.current()) != 0 ) { ++it; QButton* button = dynamic_cast<QButton*>(obj); if (button) { Q3ButtonGroup::remove(button); delete button; } } delete l; // delete the list, not the objects */ // mmueller Qt impl QList<QAbstractButton *> l = m_ToolButtonGroup->buttons(); // remove all buttons that are there QList<QAbstractButton *>::iterator it; QAbstractButton *btn; for (it = l.begin(); it != l.end(); ++it) { btn = *it; m_ToolButtonGroup->removeButton(btn); // this->removeChild(btn); delete btn; } // end mmueller Qt impl mitk::ToolManager::ToolVectorTypeConst allPossibleTools = m_ToolManager->GetTools(); mitk::ToolManager::ToolVectorTypeConst allTools; typedef std::pair<std::string::size_type, const mitk::Tool *> SortPairType; typedef std::priority_queue<SortPairType> SortedToolQueueType; SortedToolQueueType toolPositions; // clear and sort all tools // step one: find name/group of all tools in m_DisplayedGroups string. remember these positions for all tools. for (mitk::ToolManager::ToolVectorTypeConst::const_iterator iter = allPossibleTools.begin(); iter != allPossibleTools.end(); ++iter) { const mitk::Tool *tool = *iter; std::string::size_type namePos = m_DisplayedGroups.find(std::string("'") + tool->GetName() + "'"); std::string::size_type groupPos = m_DisplayedGroups.find(std::string("'") + tool->GetGroup() + "'"); if (!m_DisplayedGroups.empty() && namePos == std::string::npos && groupPos == std::string::npos) continue; // skip if (m_DisplayedGroups.empty() && std::string(tool->GetName()).length() > 0) { namePos = static_cast<std::string::size_type>(tool->GetName()[0]); } SortPairType thisPair = std::make_pair(namePos < groupPos ? namePos : groupPos, *iter); toolPositions.push(thisPair); } // step two: sort tools according to previously found positions in m_DisplayedGroups MITK_DEBUG << "Sorting order of tools (lower number --> earlier in button group)"; while (!toolPositions.empty()) { SortPairType thisPair = toolPositions.top(); MITK_DEBUG << "Position " << thisPair.first << " : " << thisPair.second->GetName(); allTools.push_back(thisPair.second); toolPositions.pop(); } std::reverse(allTools.begin(), allTools.end()); MITK_DEBUG << "Sorted tools:"; for (mitk::ToolManager::ToolVectorTypeConst::const_iterator iter = allTools.begin(); iter != allTools.end(); ++iter) { MITK_DEBUG << (*iter)->GetName(); } // try to change layout... bad? // Q3GroupBox::setColumnLayout ( m_LayoutColumns, Qt::Horizontal ); // mmueller using gridlayout instead of Q3GroupBox // this->setLayout(0); if (m_ButtonLayout == nullptr) m_ButtonLayout = new QGridLayout; /*else delete m_ButtonLayout;*/ int row(0); int column(-1); int currentButtonID(0); m_ButtonIDForToolID.clear(); m_ToolIDForButtonID.clear(); QToolButton *button = nullptr; MITK_DEBUG << "Creating buttons for tools"; // fill group box with buttons for (mitk::ToolManager::ToolVectorTypeConst::const_iterator iter = allTools.begin(); iter != allTools.end(); ++iter) { const mitk::Tool *tool = *iter; int currentToolID(m_ToolManager->GetToolID(tool)); ++column; // new line if we are at the maximum columns if (column == m_LayoutColumns) { ++row; column = 0; } button = new QToolButton; button->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); // add new button to the group MITK_DEBUG << "Adding button with ID " << currentToolID; m_ToolButtonGroup->addButton(button, currentButtonID); // ... and to the layout MITK_DEBUG << "Adding button in row/column " << row << "/" << column; m_ButtonLayout->addWidget(button, row, column); if (m_LayoutColumns == 1) { // button->setTextPosition( QToolButton::BesideIcon ); // mmueller button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); } else { // button->setTextPosition( QToolButton::BelowIcon ); // mmueller button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); } // button->setToggleButton( true ); // mmueller button->setCheckable(true); if (currentToolID == m_ToolManager->GetActiveToolID()) button->setChecked(true); QString label; if (m_GenerateAccelerators) { label += "&"; } label += tool->GetName(); QString tooltip = tool->GetName(); MITK_DEBUG << tool->GetName() << ", " << label.toLocal8Bit().constData() << ", '" << tooltip.toLocal8Bit().constData(); if (m_ShowNames) { /* button->setUsesTextLabel(true); button->setTextLabel( label ); // a label QToolTip::add( button, tooltip ); */ // mmueller Qt button->setText(label); // a label button->setToolTip(tooltip); // mmueller QFont currentFont = button->font(); currentFont.setBold(false); button->setFont(currentFont); } us::ModuleResource iconResource = tool->GetIconResource(); if (!iconResource.IsValid()) { button->setIcon(QIcon(QPixmap(tool->GetXPM()))); } else { us::ModuleResourceStream resourceStream(iconResource, std::ios::binary); resourceStream.seekg(0, std::ios::end); std::ios::pos_type length = resourceStream.tellg(); resourceStream.seekg(0, std::ios::beg); char *data = new char[length]; resourceStream.read(data, length); QPixmap pixmap; pixmap.loadFromData(QByteArray::fromRawData(data, length)); QIcon *icon = new QIcon(pixmap); delete[] data; button->setIcon(*icon); if (m_ShowNames) { if (m_LayoutColumns == 1) button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); else button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); button->setIconSize(QSize(24, 24)); } else { button->setToolButtonStyle(Qt::ToolButtonIconOnly); button->setIconSize(QSize(32, 32)); button->setToolTip(tooltip); } } if (m_GenerateAccelerators) { QString firstLetter = QString(tool->GetName()); firstLetter.truncate(1); button->setShortcut( firstLetter); // a keyboard shortcut (just the first letter of the given name w/o any CTRL or something) } mitk::DataNode *dataNode = m_ToolManager->GetReferenceData(0); if (dataNode != nullptr && !tool->CanHandle(dataNode->GetData())) button->setEnabled(false); m_ButtonIDForToolID[currentToolID] = currentButtonID; m_ToolIDForButtonID[currentButtonID] = currentToolID; MITK_DEBUG << "m_ButtonIDForToolID[" << currentToolID << "] == " << currentButtonID; MITK_DEBUG << "m_ToolIDForButtonID[" << currentButtonID << "] == " << currentToolID; tool->GUIProcessEventsMessage += mitk::MessageDelegate<QmitkToolSelectionBox>( this, &QmitkToolSelectionBox::OnToolGUIProcessEventsMessage); // will never add a listener twice, so we don't have // to check here tool->ErrorMessage += mitk::MessageDelegate1<QmitkToolSelectionBox, std::string>( this, &QmitkToolSelectionBox::OnToolErrorMessage); // will never add a listener twice, so we don't have to check here tool->GeneralMessage += mitk::MessageDelegate1<QmitkToolSelectionBox, std::string>(this, &QmitkToolSelectionBox::OnGeneralToolMessage); ++currentButtonID; } // setting grid layout for this groupbox this->setLayout(m_ButtonLayout); // this->update(); }
HRMEMainWindow::HRMEMainWindow(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { meshLoader = new MeshLoader(); mapEditor = new MapEditorWidget(); setCentralWidget(mapEditor); connect(mapEditor, SIGNAL(selectedObjectChanged(MapObject*)), this, SLOT(setSelectedObject(MapObject*))); connect(mapEditor, SIGNAL(propMeshAdded(string)), this, SLOT(addPropMesh(string))); connect(mapEditor, SIGNAL(propMeshesChanged(vector<string>)), this, SLOT(setPropMeshes(vector<string>))); // settingsManager = new SettingsManager("mapeditorconfig.txt"); /*Actions*************************************************************/ advancedRenderingAction = new QAction("&Advanced Rendering", this); advancedRenderingAction->setCheckable(true); advancedRenderingAction->setShortcut(QKeySequence(Qt::Key_Z)); advancedRenderingAction->setIcon(QIcon("editoricons/iconadvancedrendering.png")); connect(advancedRenderingAction, SIGNAL(toggled(bool)), mapEditor, SLOT(setAdvancedRendering(bool))); orthoCameraAction = new QAction("&Orthographic View", this); orthoCameraAction->setCheckable(true); orthoCameraAction->setShortcut(QKeySequence(Qt::Key_X)); orthoCameraAction->setIcon(QIcon("editoricons/iconorthoview.png")); connect(orthoCameraAction, SIGNAL(toggled(bool)), mapEditor, SLOT(setOrthoView(bool))); showPaintAction = new QAction("&Show Paint", this); showPaintAction->setCheckable(true); showPaintAction->setShortcut(QKeySequence(Qt::Key_C)); showPaintAction->setIcon(QIcon("editoricons/iconshowpaint.png")); connect(showPaintAction, SIGNAL(toggled(bool)), mapEditor, SLOT(setShowPaint(bool))); showInvisibleAction = new QAction("&Show Invisible", this); showInvisibleAction->setCheckable(true); showInvisibleAction->setShortcut(QKeySequence(Qt::Key_V)); showInvisibleAction->setIcon(QIcon("editoricons/iconshowinvisible.png")); connect(showInvisibleAction, SIGNAL(toggled(bool)), mapEditor, SLOT(setShowInvisible(bool))); //Map Objects mapObjectGroup = new QActionGroup(this); mapObjectGroup->setExclusive(true); connect(mapObjectGroup, SIGNAL(triggered(QAction*)), this, SLOT(selectMapObject(QAction*))); for (int i = 0; i < MapObject::NUM_OBJECT_TYPES; i++) { MapObject::ObjectType type = static_cast<MapObject::ObjectType>(i); mapObjectAction[i] = new QAction(QString(MapObject::typeTitle(type).c_str()), this); mapObjectAction[i]->setCheckable(true); mapObjectGroup->addAction(mapObjectAction[i]); mapObjectAction[i]->setShortcut(QKeySequence(Qt::Key_1+i)); drawMapObjectAction[i] = new QAction(QString("Show ")+QString(MapObject::typeTitle(type).c_str()), this); drawMapObjectAction[i]->setCheckable(true); drawMapObjectAction[i]->setChecked(mapEditor->getDrawMapObject()[i]); connect(drawMapObjectAction[i], SIGNAL(toggled(bool)), this, SLOT(updateDrawMapObjects())); switch (type) { case MapObject::LIGHT: mapObjectAction[i]->setIcon(QIcon("editoricons/iconlight.png")); break; case MapObject::MESH_INSTANCE: mapObjectAction[i]->setIcon(QIcon("editoricons/iconmeshinstance.png")); break; case MapObject::PATH_NODE: mapObjectAction[i]->setIcon(QIcon("editoricons/iconpathnode.png")); break; case MapObject::START_POINT: mapObjectAction[i]->setIcon(QIcon("editoricons/iconstartpoint.png")); break; case MapObject::FINISH_PLANE: mapObjectAction[i]->setIcon(QIcon("editoricons/iconfinishplane.png")); break; default: break; } } //Edit Modes editModeGroup = new QActionGroup(this); editModeGroup->setExclusive(true); connect(editModeGroup, SIGNAL(triggered(QAction*)), this, SLOT(selectEditMode(QAction*))); for (int i = 0; i < MapEditorWidget::NUM_EDIT_MODES; i++) { MapEditorWidget::EditMode mode = static_cast<MapEditorWidget::EditMode>(i); editModeAction[i] = new QAction(QString(MapEditorWidget::editModeTitle(mode).c_str()), this); editModeAction[i]->setCheckable(true); editModeAction[i]->setShortcut(QKeySequence(Qt::Key_1+i)); switch (mode) { case MapEditorWidget::EDIT_TRANSLATE: editModeAction[i]->setShortcut(QKeySequence(Qt::Key_T)); editModeAction[i]->setIcon(QIcon("editoricons/icontranslate.png")); break; case MapEditorWidget::EDIT_ROTATE: editModeAction[i]->setShortcut(QKeySequence(Qt::Key_R)); editModeAction[i]->setIcon(QIcon("editoricons/iconrotate.png")); break; case MapEditorWidget::EDIT_SCALE: editModeAction[i]->setShortcut(QKeySequence(Qt::Key_F)); editModeAction[i]->setIcon(QIcon("editoricons/iconscale.png")); break; case MapEditorWidget::EDIT_LINK: editModeAction[i]->setShortcut(QKeySequence(Qt::Key_G)); editModeAction[i]->setIcon(QIcon("editoricons/iconlink.png")); break; default: break; } if (i == 0) editModeAction[i]->setChecked(true); editModeGroup->addAction(editModeAction[i]); } /*Menu Bar*************************************************************/ menuBar = new QMenuBar(this); //File Menu fileMenu = new QMenu("&File", this); QAction* newAction = fileMenu->addAction("&New", mapEditor, SLOT(newMap()), QKeySequence("CTRL+N")); connect(newAction, SIGNAL(triggered()), this, SLOT(newMap())); fileMenu->addAction("&Open", this, SLOT(openMapFile()), QKeySequence("CTRL+O")); saveAction = fileMenu->addAction("&Save", mapEditor, SLOT(saveMap()), QKeySequence("CTRL+S")); saveAction->setDisabled(true); fileMenu->addAction("&Save As", this, SLOT(saveMapFileAs()), QKeySequence("CTRL+ALT+S")); fileMenu->addAction("&Quit", qApp, SLOT(quit()), QKeySequence("CTRL+Q")); //Edit Menu editMenu = new QMenu("&Edit", this); editMenu->addAction("&Delete", mapEditor, SLOT(deleteSelected()), QKeySequence(Qt::Key_Delete)); editMenu->addAction("&Delete All", mapEditor, SLOT(deleteAll()), QKeySequence(Qt::Key_Control + Qt::Key_Delete)); //View Menu viewMenu = new QMenu("&View", this); viewMenu->addAction(advancedRenderingAction); viewMenu->addAction(orthoCameraAction); viewMenu->addAction(showPaintAction); viewMenu->addAction(showInvisibleAction); viewMenu->addSeparator(); for (int i = 0; i < MapObject::NUM_OBJECT_TYPES; i++) viewMenu->addAction(drawMapObjectAction[i]); //Meshes Menu meshMenu = new QMenu("&Mesh", this); meshLoadMapper = new QSignalMapper(this); connect(meshLoadMapper, SIGNAL(mapped(int)), this, SLOT(loadMesh(int))); meshClearMapper = new QSignalMapper(this); connect(meshClearMapper, SIGNAL(mapped(int)), this, SLOT(clearMesh(int))); for (int i = 0; i < HRMap::NUM_MESHES; i++) { HRMap::MeshType type = static_cast<HRMap::MeshType>(i); QAction* load_mesh_action = new QAction(QString(("Load "+HRMap::meshTitle(type)).c_str()), this); QAction* clear_mesh_action = new QAction(QString(("Clear "+HRMap::meshTitle(type)).c_str()), this); meshLoadMapper->setMapping(load_mesh_action, i); meshClearMapper->setMapping(clear_mesh_action, i); connect(load_mesh_action, SIGNAL(triggered()), meshLoadMapper, SLOT(map())); connect(clear_mesh_action, SIGNAL(triggered()), meshClearMapper, SLOT(map())); meshMenu->addAction(load_mesh_action); meshMenu->addAction(clear_mesh_action); } //Map Menu mapMenu = new QMenu("&Map", this); mapMenu->addAction("&Edit Map Options", mapEditor, SLOT(showOptionsDialog())); mapMenu->addSeparator(); mapMenu->addAction("&Generate Paint Cells", mapEditor, SLOT(generatePaint())); mapMenu->addAction("&Clear Paint Cells", mapEditor, SLOT(clearPaint())); mapMenu->addSeparator(); mapMenu->addAction("&Generate Path Progression", mapEditor, SLOT(generatePathProgress())); mapMenu->addAction("&Generate 2D Map", this, SLOT(save2DMapImage())); mapMenu->addSeparator(); mapMenu->addAction("&Load Cube Map", mapEditor, SLOT(loadCubeMap())); mapMenu->addSeparator(); mapMenu->addAction("&Load Prop Mesh", this, SLOT(loadPropMesh())); mapMenu->addAction("&Remove Prop Mesh", mapEditor, SLOT(removePropMesh())); mapMenu->addSeparator(); mapMenu->addAction("&Translate All Map Objects", this, SLOT(translateAll())); mapMenu->addAction("&Scale All Map Objects", this, SLOT(scaleAll())); menuBar->addMenu(fileMenu); menuBar->addMenu(editMenu); menuBar->addMenu(viewMenu); menuBar->addMenu(meshMenu); menuBar->addMenu(mapMenu); setMenuBar(menuBar); /*Options Toolbar*************************************************************/ optionsFrame = new QFrame(this); optionsBar = new QToolBar(this); QHBoxLayout* viewing_layout = new QHBoxLayout(this); QHBoxLayout* options_layout = new QHBoxLayout(this); QHBoxLayout* objects_layout = new QHBoxLayout(this); QHBoxLayout* edit_mode_layout = new QHBoxLayout(this); QHBoxLayout* prop_mesh_layout = new QHBoxLayout(this); //Viewing buttons QToolButton* advancedRenderingButton = new QToolButton(this); advancedRenderingButton->setDefaultAction(advancedRenderingAction); advancedRenderingButton->setIconSize(QSize(32, 32)); QToolButton* orthoCameraButton = new QToolButton(this); orthoCameraButton->setDefaultAction(orthoCameraAction); orthoCameraButton->setIconSize(QSize(32, 32)); QToolButton* showPaintButton = new QToolButton(this); showPaintButton->setDefaultAction(showPaintAction); showPaintButton->setIconSize(QSize(32, 32)); QToolButton* showInvisibleButton = new QToolButton(this); showInvisibleButton->setDefaultAction(showInvisibleAction); showInvisibleButton->setIconSize(QSize(32, 32)); viewing_layout->addWidget(advancedRenderingButton); viewing_layout->addWidget(orthoCameraButton); viewing_layout->addWidget(showPaintButton); viewing_layout->addWidget(showInvisibleButton); viewing_layout->setAlignment(Qt::AlignLeft); //Object buttons for (int i = 0; i < MapObject::NUM_OBJECT_TYPES; i++) { QToolButton* object_button = new QToolButton(this); object_button->setDefaultAction(mapObjectAction[i]); object_button->setIconSize(QSize(32, 32)); objects_layout->addWidget(object_button); } //Edit Mode Buttons for (int i = 0; i < MapEditorWidget::NUM_EDIT_MODES; i++) { QToolButton* edit_mode_button = new QToolButton(this); edit_mode_button->setDefaultAction(editModeAction[i]); edit_mode_layout->addWidget(edit_mode_button); edit_mode_button->setIconSize(QSize(32, 32)); } //Prop Mesh Box propMeshBox = new QComboBox(this); connect(propMeshBox, SIGNAL(currentIndexChanged(int)), mapEditor, SLOT(setPropMeshIndex(int))); propMeshBox->setMinimumContentsLength(30); prop_mesh_layout->addWidget(new QLabel("Prop Mesh:", this)); prop_mesh_layout->addWidget(propMeshBox); //Toolbar Setup objects_layout->setAlignment(Qt::AlignRight); objects_layout->setContentsMargins(0,0,0,0); options_layout->addLayout(viewing_layout); options_layout->addSpacing(15); options_layout->addLayout(objects_layout); options_layout->addSpacing(15); options_layout->addLayout(edit_mode_layout); options_layout->addSpacing(15); options_layout->addLayout(prop_mesh_layout); optionsFrame->setLayout(options_layout); optionsBar->addWidget(optionsFrame); addToolBar(Qt::TopToolBarArea, optionsBar); /*Properties*************************************************************/ objectPropertiesBar = new QToolBar(this); objectPropertiesBar->addWidget(new QLabel("Object Properties", objectPropertiesBar)); objectPropertiesBar->setMinimumWidth(170); objectPropertiesBar->setMinimumHeight(120); //Position positionPropertyFrame = new QFrame(this); double range = 9999999.9; double single_step = 0.1; int decimals = 5; positionXBox = new QDoubleSpinBox(positionPropertyFrame); positionXBox->setRange(-range, range); positionXBox->setDecimals(decimals); positionXBox->setSingleStep(single_step); positionYBox = new QDoubleSpinBox(positionPropertyFrame); positionYBox->setRange(-range, range); positionYBox->setDecimals(decimals); positionYBox->setSingleStep(single_step); positionZBox = new QDoubleSpinBox(positionPropertyFrame); positionZBox->setRange(-range, range); positionZBox->setDecimals(decimals); positionZBox->setSingleStep(single_step); connect(positionXBox, SIGNAL(valueChanged(double)), mapEditor, SLOT(setSelectedPositionX(double))); connect(positionYBox, SIGNAL(valueChanged(double)), mapEditor, SLOT(setSelectedPositionY(double))); connect(positionZBox, SIGNAL(valueChanged(double)), mapEditor, SLOT(setSelectedPositionZ(double))); connect(mapEditor, SIGNAL(selectedPositionXChanged(double)), positionXBox, SLOT(setValue(double))); connect(mapEditor, SIGNAL(selectedPositionYChanged(double)), positionYBox, SLOT(setValue(double))); connect(mapEditor, SIGNAL(selectedPositionZChanged(double)), positionZBox, SLOT(setValue(double))); QGridLayout* position_layout = new QGridLayout(this); position_layout->addWidget(new QLabel("Position", positionPropertyFrame), 0, 0); position_layout->addWidget(new QLabel("X", positionPropertyFrame), 1, 0); position_layout->addWidget(positionXBox, 1, 1); position_layout->addWidget(new QLabel("Y", positionPropertyFrame), 2, 0); position_layout->addWidget(positionYBox, 2, 1); position_layout->addWidget(new QLabel("Z", positionPropertyFrame), 3, 0); position_layout->addWidget(positionZBox, 3, 1); positionPropertyFrame->setLayout(position_layout); QObjectList children = positionPropertyFrame->children(); for (int i = 0; i < children.size(); i++) { if (dynamic_cast<QWidget*>(children[i])) objectPropertyWidgets.append((QWidget*)children[i]); } //Rotation rotationPropertyFrame = new QFrame(this); range = 360; single_step = 0.5; decimals = 5; rotationYawBox = new QDoubleSpinBox(rotationPropertyFrame); rotationYawBox->setRange(0.0, range); rotationYawBox->setDecimals(decimals); rotationYawBox->setSingleStep(single_step); rotationPitchBox = new QDoubleSpinBox(rotationPropertyFrame); rotationPitchBox->setRange(0.0, range); rotationPitchBox->setDecimals(decimals); rotationPitchBox->setSingleStep(single_step); rotationRollBox = new QDoubleSpinBox(rotationPropertyFrame); rotationRollBox->setRange(0.0, range); rotationRollBox->setDecimals(decimals); rotationRollBox->setSingleStep(single_step); connect(rotationYawBox, SIGNAL(valueChanged(double)), mapEditor, SLOT(setRotationYaw(double))); connect(rotationPitchBox, SIGNAL(valueChanged(double)), mapEditor, SLOT(setRotationPitch(double))); connect(rotationRollBox, SIGNAL(valueChanged(double)), mapEditor, SLOT(setRotationRoll(double))); connect(mapEditor, SIGNAL(selectedRotationYawChanged(double)), rotationYawBox, SLOT(setValue(double))); connect(mapEditor, SIGNAL(selectedRotationPitchChanged(double)), rotationPitchBox, SLOT(setValue(double))); connect(mapEditor, SIGNAL(selectedRotationRollChanged(double)), rotationRollBox, SLOT(setValue(double))); QGridLayout* rotation_layout = new QGridLayout(this); rotation_layout->addWidget(new QLabel("Rotation", rotationPropertyFrame), 0, 0); rotation_layout->addWidget(new QLabel("Yaw", rotationPropertyFrame), 1, 0); rotation_layout->addWidget(rotationYawBox, 1, 1); rotation_layout->addWidget(new QLabel("Pitch", rotationPropertyFrame), 2, 0); rotation_layout->addWidget(rotationPitchBox, 2, 1); rotation_layout->addWidget(new QLabel("Roll", rotationPropertyFrame), 3, 0); rotation_layout->addWidget(rotationRollBox, 3, 1); rotationPropertyFrame->setLayout(rotation_layout); children = rotationPropertyFrame->children(); for (int i = 0; i < children.size(); i++) { if (dynamic_cast<QWidget*>(children[i])) objectPropertyWidgets.append((QWidget*)children[i]); } //Scale scalePropertyFrame = new QFrame(this); range = 1000; single_step = 0.05; decimals = 5; scaleBox = new QDoubleSpinBox(scalePropertyFrame); scaleBox->setRange(0.0, range); scaleBox->setDecimals(decimals); scaleBox->setSingleStep(single_step); connect(scaleBox, SIGNAL(valueChanged(double)), mapEditor, SLOT(setSelectedScale(double))); connect(mapEditor, SIGNAL(selectedScaleChanged(double)), scaleBox, SLOT(setValue(double))); QGridLayout* scale_layout = new QGridLayout(this); scale_layout->addWidget(new QLabel("Scale", scalePropertyFrame), 0, 0); scale_layout->addWidget(scaleBox); scalePropertyFrame->setLayout(scale_layout); children = scalePropertyFrame->children(); for (int i = 0; i < children.size(); i++) { if (dynamic_cast<QWidget*>(children[i])) objectPropertyWidgets.append((QWidget*)children[i]); } //Colors colorPropertyFrame = new QFrame(this); QGridLayout* color_layout = new QGridLayout(this); colorPropertyMapper = new QSignalMapper(this); connect(colorPropertyMapper, SIGNAL(mapped(int)), this, SLOT(choosePropertyColor(int))); color_layout->addWidget(new QLabel("Color", colorPropertyFrame), 0, 0); for (int i = 0; i < 3; i++) { QString color_name; if (i == 0) color_name = "Diffuse"; else if (i == 1) color_name = "Specular"; else color_name = "Ambient"; QPushButton* color_button = new QPushButton(color_name, colorPropertyFrame); connect(color_button, SIGNAL(clicked()), colorPropertyMapper, SLOT(map())); colorPropertyMapper->setMapping(color_button, i); color_layout->addWidget(color_button, 1+i, 0); } colorPropertyFrame->setLayout(color_layout); children = colorPropertyFrame->children(); for (int i = 0; i < children.size(); i++) { if (dynamic_cast<QWidget*>(children[i])) objectPropertyWidgets.append((QWidget*)children[i]); } //Attenuation attenuationPropertyFrame = new QFrame(this); QGridLayout* light_layout = new QGridLayout(this); range = 1000; single_step = 0.05; decimals = 2; lightStrengthBox = new QDoubleSpinBox(attenuationPropertyFrame); lightStrengthBox->setRange(1.0, range); lightStrengthBox->setDecimals(decimals); lightStrengthBox->setSingleStep(single_step); connect(lightStrengthBox, SIGNAL(valueChanged(double)), mapEditor, SLOT(setLightStrength(double))); lightAttenuationBox = new QCheckBox(attenuationPropertyFrame); connect(lightAttenuationBox, SIGNAL(toggled(bool)), mapEditor, SLOT(setLightHasAttenuation(bool))); light_layout->addWidget(new QLabel("Attenuation", attenuationPropertyFrame), 0, 0); light_layout->addWidget(new QLabel("Strength", attenuationPropertyFrame), 1, 0); light_layout->addWidget(lightStrengthBox, 1, 1); light_layout->addWidget(new QLabel("Has Attenuation", attenuationPropertyFrame), 2, 0); light_layout->addWidget(lightAttenuationBox, 2, 1); attenuationPropertyFrame->setLayout(light_layout); children = attenuationPropertyFrame->children(); for (int i = 0; i < children.size(); i++) { if (dynamic_cast<QWidget*>(children[i])) objectPropertyWidgets.append((QWidget*)children[i]); } //Mesh Instances meshInstancePropertyFrame = new QFrame(this); QGridLayout* mesh_instance_layout = new QGridLayout(this); instanceTypeBox = new QComboBox(meshInstancePropertyFrame); instanceTypeBox->setMinimumContentsLength(15); for (int i = 0; i < MeshInstance::NUM_INSTANCE_TYPES; i++) { instanceTypeBox->addItem( QString(MeshInstance::getTypeTitle(static_cast<MeshInstance::InstanceType>(i)).c_str()) ); } connect(instanceTypeBox, SIGNAL(currentIndexChanged(int)), mapEditor, SLOT(setMeshInstanceType(int))); mesh_instance_layout->addWidget(new QLabel("Mesh Instance Type", meshInstancePropertyFrame), 0, 0); mesh_instance_layout->addWidget(instanceTypeBox, 1, 0); children = meshInstancePropertyFrame->children(); for (int i = 0; i < children.size(); i++) { if (dynamic_cast<QWidget*>(children[i])) objectPropertyWidgets.append((QWidget*)children[i]); } objectPropertiesBar->addWidget(positionPropertyFrame); objectPropertiesBar->addWidget(rotationPropertyFrame); objectPropertiesBar->addWidget(scalePropertyFrame); objectPropertiesBar->addWidget(colorPropertyFrame); objectPropertiesBar->addWidget(attenuationPropertyFrame); objectPropertiesBar->addWidget(meshInstancePropertyFrame); addToolBar(Qt::LeftToolBarArea, objectPropertiesBar); /*File Types and Paths*************************************************************/ #ifdef WIN32 char currentPath[_MAX_PATH]; getcwd(currentPath, _MAX_PATH); saveDir = QString(currentPath); meshDir = QString(currentPath); propMeshDir = QString(currentPath); #else std::string currentPath = boost::filesystem::current_path().string(); saveDir = QString::fromStdString(currentPath); meshDir = QString::fromStdString(currentPath); propMeshDir = QString::fromStdString(currentPath); #endif mapType = QString("HexRace Map File (*.hrm *.HRM)"); meshType = QString("Wavefront OBJ (*.obj *.OBJ)"); pngType = QString("Portable Network Graphics (*.png)"); //Initialize mapObjectAction[0]->setChecked(true); selectMapObject(mapObjectAction[0]); setSelectedObject(NULL); }
void ParameterWidget::addParam() { XComboBox *xcomboBox = new XComboBox(_filterGroup); QToolButton *toolButton = new QToolButton(_filterGroup); QLineEdit *lineEdit = new QLineEdit(_filterGroup); QGridLayout *gridLayout = new QGridLayout(); QVBoxLayout *xcomboLayout = new QVBoxLayout(); QHBoxLayout *widgetLayout1 = new QHBoxLayout(); QVBoxLayout *widgetLayout2 = new QVBoxLayout(); QVBoxLayout *buttonLayout = new QVBoxLayout(); int nextRow = _filtersLayout->rowCount(); QString currRow = QString().setNum(nextRow); // Set up objects gridLayout->setObjectName("topLayout" + currRow); xcomboLayout->setObjectName("xcomboLayout" + currRow); xcomboLayout->setContentsMargins(0, 0, 0, 0); xcomboBox->setObjectName("xcomboBox" + currRow); xcomboBox->addItem("", currRow + ":" + "2"); widgetLayout1->setObjectName("widgetLayout1" + currRow); widgetLayout2->setObjectName("widgetLayout2" + currRow); widgetLayout2->setContentsMargins(0, 0, 0, 0); lineEdit->setObjectName("widget" + currRow); lineEdit->setDisabled(true); buttonLayout->setObjectName("buttonLayout" + currRow); buttonLayout->setContentsMargins(0, 0, 0, 0); toolButton->setObjectName("button" + currRow); toolButton->setText(tr("-")); //grab the items provided by other widgets to populate xcombobox with QMapIterator<QString, QPair<QString, ParameterWidgetTypes> > i(_types); while (i.hasNext()) { i.next(); QPair<QString, ParameterWidgetTypes> tempPair = i.value(); QString value = QString().setNum(nextRow) + ":" + QString().setNum(tempPair.second); if ( _usedTypes.isEmpty() || !containsUsedType(i.key()) ) xcomboBox->addItem(i.key(), value ); } xcomboLayout->addWidget(xcomboBox); xcomboLayout->addItem(new QSpacerItem(20, 0, QSizePolicy::Fixed, QSizePolicy::Expanding)); // Place the default line edit/button combo widgetLayout1->addWidget(lineEdit); widgetLayout1->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Fixed)); widgetLayout2->addLayout(widgetLayout1); widgetLayout2->addItem(new QSpacerItem(20, 0, QSizePolicy::Fixed, QSizePolicy::Expanding)); gridLayout->addLayout(widgetLayout2, 0, 0, 1, 1); // Place Button buttonLayout->addWidget(toolButton); buttonLayout->addItem(new QSpacerItem(10, 0, QSizePolicy::Fixed, QSizePolicy::Expanding)); gridLayout->addLayout(buttonLayout, 0, 1, 1, 1); _filtersLayout->addLayout(gridLayout, nextRow, 1, 1, 1); _filtersLayout->addLayout(xcomboLayout, nextRow, 0, 1, 1); // Hook up connections connect(toolButton, SIGNAL(clicked()), _filterSignalMapper, SLOT(map())); connect(toolButton, SIGNAL(clicked()), gridLayout, SLOT( deleteLater() ) ); connect(toolButton, SIGNAL(clicked()), xcomboBox, SLOT( deleteLater() ) ); connect(toolButton, SIGNAL(clicked()), lineEdit, SLOT( deleteLater() ) ); connect(toolButton, SIGNAL(clicked()), toolButton, SLOT( deleteLater() ) ); connect(xcomboBox, SIGNAL(currentIndexChanged(int)), this, SLOT( changeFilterObject(int)) ); connect(lineEdit, SIGNAL(editingFinished()), this, SLOT( storeFilterValue() ) ); _filterSignalMapper->setMapping(toolButton, nextRow); _addFilterRow->setDisabled(true); }
void EFFEditorScenePanel::renderModeMenuPressed(QAction * action) { QToolButton * renderMode = qobject_cast<QToolButton *>(action->parentWidget()->parentWidget()); renderMode->setText(action->text()); }
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) { const int screenWidth = QApplication::desktop()->width(); const int screenHeight = QApplication::desktop()->height(); const int appWidth = 500; const int appHeight = 300; setGeometry((screenWidth - appWidth) / 2, (screenHeight - appHeight) / 2, appWidth, appHeight); setObjectName("mainwindow"); setWindowTitle("developers' test version, not for public use"); setWindowIcon(QIcon(":/icons/icon64.png")); setContextMenuPolicy(Qt::PreventContextMenu); QDockWidget* friendDock = new QDockWidget(this); friendDock->setObjectName("FriendDock"); friendDock->setFeatures(QDockWidget::NoDockWidgetFeatures); friendDock->setTitleBarWidget(new QWidget(friendDock)); friendDock->setContextMenuPolicy(Qt::PreventContextMenu); addDockWidget(Qt::LeftDockWidgetArea, friendDock); QWidget* friendDockWidget = new QWidget(friendDock); QVBoxLayout* layout = new QVBoxLayout(friendDockWidget); layout->setMargin(0); layout->setSpacing(0); friendDock->setWidget(friendDockWidget); ourUserItem = new OurUserItemWidget(this); friendsWidget = new FriendsWidget(friendDockWidget); // Create toolbar QToolBar *toolBar = new QToolBar(this); toolBar->setToolButtonStyle(Qt::ToolButtonIconOnly); toolBar->setIconSize(QSize(16, 16)); toolBar->setFocusPolicy(Qt::ClickFocus); QToolButton *addFriendButton = new QToolButton(toolBar); addFriendButton->setIcon(QIcon("://icons/user_add.png")); addFriendButton->setToolTip(tr("Add friend")); connect(addFriendButton, &QToolButton::clicked, friendsWidget, &FriendsWidget::onAddFriendButtonClicked); QWidget *spacer = new QWidget(toolBar); spacer->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); QToolButton *menuButton = new QToolButton(toolBar); menuButton->setIcon(QIcon("://icons/cog.png")); menuButton->setToolTip(tr("Mainmenu")); menuButton->setPopupMode(QToolButton::InstantPopup); QMenu *mainmenu = new QMenu(menuButton); mainmenu->addAction(QIcon(":/icons/setting_tools.png"), tr("Settings"), this, SLOT(onSettingsActionTriggered())); mainmenu->addSeparator(); mainmenu->addAction(tr("About %1").arg(AppInfo::name), this, SLOT(onAboutAppActionTriggered())); mainmenu->addAction(tr("About Qt"), qApp, SLOT(aboutQt())); mainmenu->addSeparator(); mainmenu->addAction(tr("Quit"), this, SLOT(onQuitApplicationTriggered()), QKeySequence::Quit); menuButton->setMenu(mainmenu); toolBar->addWidget(addFriendButton); toolBar->addWidget(spacer); toolBar->addWidget(menuButton); // Create toolbar end layout->addWidget(ourUserItem); layout->addWidget(friendsWidget); layout->addWidget(toolBar); PagesWidget* pages = new PagesWidget(this); connect(friendsWidget, &FriendsWidget::friendAdded, pages, &PagesWidget::addPage); connect(friendsWidget, &FriendsWidget::friendSelectionChanged, pages, &PagesWidget::activatePage); connect(friendsWidget, &FriendsWidget::friendStatusChanged, pages, &PagesWidget::statusChanged); //FIXME: start core in a separate function //all connections to `core` should be done after its creation because it registers some types core = new Core(); coreThread = new QThread(this); core->moveToThread(coreThread); connect(coreThread, &QThread::started, core, &Core::start); qRegisterMetaType<Status>("Status"); connect(core, &Core::connected, this, &MainWindow::onConnected); connect(core, &Core::disconnected, this, &MainWindow::onDisconnected); connect(core, &Core::friendRequestRecieved, this, &MainWindow::onFriendRequestRecieved); connect(core, SIGNAL(friendStatusChanged(int, Status)), friendsWidget, SLOT(setStatus(int, Status))); connect(core, &Core::friendAddressGenerated, ourUserItem, &OurUserItemWidget::setFriendAddress); connect(core, &Core::friendAdded, friendsWidget, &FriendsWidget::addFriend); connect(core, &Core::friendMessageRecieved, pages, &PagesWidget::messageReceived); connect(core, &Core::actionReceived, pages, &PagesWidget::actionReceived); connect(core, &Core::friendUsernameChanged, friendsWidget, &FriendsWidget::setUsername); connect(core, &Core::friendUsernameChanged, pages, &PagesWidget::usernameChanged); connect(core, &Core::friendRemoved, friendsWidget, &FriendsWidget::removeFriend); connect(core, &Core::friendRemoved, pages, &PagesWidget::removePage); connect(core, &Core::failedToRemoveFriend, this, &MainWindow::onFailedToRemoveFriend); connect(core, &Core::failedToAddFriend, this, &MainWindow::onFailedToAddFriend); connect(core, &Core::messageSentResult, pages, &PagesWidget::messageSentResult); connect(core, &Core::actionSentResult, pages, &PagesWidget::actionResult); coreThread->start(/*QThread::IdlePriority*/); connect(this, &MainWindow::friendRequestAccepted, core, &Core::acceptFriendRequest); connect(ourUserItem, &OurUserItemWidget::usernameChanged, core, &Core::setUsername); connect(core, &Core::usernameSet, ourUserItem, &OurUserItemWidget::setUsername); connect(ourUserItem, &OurUserItemWidget::statusMessageChanged, core, &Core::setStatusMessage); connect(core, &Core::statusMessageSet, ourUserItem, &OurUserItemWidget::setStatusMessage); connect(ourUserItem, &OurUserItemWidget::statusSelected, core, &Core::setStatus); connect(pages, &PagesWidget::sendMessage, core, &Core::sendMessage); connect(pages, &PagesWidget::sendAction, core, &Core::sendAction); connect(friendsWidget, &FriendsWidget::friendRequested, core, &Core::requestFriendship); connect(friendsWidget, &FriendsWidget::friendRemoved, core, &Core::removeFriend); setCentralWidget(pages); Settings::getInstance().loadWindow(this); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); ui->textBrowser->setText("Bienvenue dans MediaInfo"); C = new Core(); settings = new QSettings("MediaArea.net","MediaInfo"); defaultSettings(); applySettings(); view = (ViewMode)settings->value("defaultView",VIEW_EASY).toInt(); // View menu: QActionGroup* menuItemGroup = new QActionGroup(this); for(int v=VIEW_EASY;v<NB_VIEW;v++) { QAction* action = new QAction(nameView((ViewMode)v),ui->menuView); action->setCheckable(true); if(view==v) action->setChecked(true); action->setProperty("view",v); ui->menuView->addAction(action); menuItemGroup->addAction(action); } connect(menuItemGroup,SIGNAL(selected(QAction*)),SLOT(actionView_toggled(QAction*))); menuItemGroup->setParent(ui->menuView); QToolButton* tb = new QToolButton(ui->toolBar); tb->setMenu(ui->menuView); tb->setText("view"); tb->setPopupMode(QToolButton::InstantPopup); tb->setIcon(QIcon(":/icon/view.svg")); connect(ui->toolBar,SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle)),tb,SLOT(setToolButtonStyle(Qt::ToolButtonStyle))); ui->toolBar->addWidget(tb); ui->toolBar->setContextMenuPolicy(Qt::CustomContextMenu); this->connect(ui->toolBar,SIGNAL(customContextMenuRequested(QPoint)),SLOT(toolBarOptions(QPoint))); /* TODO QIcon::setThemeName("gnome-dust"); ui->actionQuit->setIcon(QIcon::fromTheme("application-exit")); ui->actionOpen->setIcon(QIcon::fromTheme("document-open",QIcon(":/icon/openfile.svg"))); ui->actionExport->setIcon(QIcon::fromTheme("document-save",QIcon(":/icon/export.svg"))); ui->actionAbout->setIcon(QIcon::fromTheme("help-about",QIcon(":/icon/about.svg"))); */ timer=NULL; progressDialog=NULL; refreshDisplay(); if(QCoreApplication::arguments().count()>1) { QStringList files = QCoreApplication::arguments(); files.removeAt(0); openFiles(files); } /* qDebug() << "0.7 " << "0.7.5 " << isNewer("0.7","0.7.5"); qDebug() << "0.7.4 " << "0.7.5 " << isNewer("0.7.4","0.7.5"); qDebug() << "0.7.5 " << "0.7.4 " << isNewer("0.7.5","0.7.4"); qDebug() << "0.7.4 " << "0.7 " << isNewer("0.7.4","0.7"); qDebug() << "0.7.5 " << "0.7.5 " << isNewer("0.7.5","0.7.5"); */ #ifdef NEW_VERSION if(settings->value("checkForNewVersion",true).toBool()) { checkForNewVersion(); } #endif }
void EFFEditorScenePanel::createToolbar() { m_pToolbar = new QToolBar(NULL); m_pToolbar->setObjectName("toolbar"); m_pToolbar->setMinimumHeight(TOOLBAR_MIN_HEIGHT); m_pToolbar->addWidget(new QLabel()); m_pToolbar->addSeparator(); QToolButton * drawMode = new QToolButton(); drawMode->setToolButtonStyle(Qt::ToolButtonTextOnly); drawMode->setPopupMode(QToolButton::InstantPopup); drawMode->setObjectName(tr("drawMode")); QMenu * drawModeMenu = new QMenu(drawMode); drawModeMenu->addAction(new QAction(tr("Textured"), drawModeMenu)); drawModeMenu->addAction(new QAction(tr("Wireframe"), drawModeMenu)); drawModeMenu->addAction(new QAction(tr("Tex-Wire"), drawModeMenu)); connect(drawModeMenu, SIGNAL(triggered(QAction *)), this, SLOT(drawModeMenuPressed(QAction *))); drawMode->setMenu(drawModeMenu); m_pToolbar->addWidget(drawMode); QMetaObject::invokeMethod(drawModeMenu, "triggered", Q_ARG(QAction *, *drawModeMenu->actions().begin())); m_pToolbar->addSeparator(); m_pToolbar->addWidget(new QLabel()); m_pToolbar->addSeparator(); QToolButton * renderMode = new QToolButton(); renderMode->setToolButtonStyle(Qt::ToolButtonTextOnly); renderMode->setPopupMode(QToolButton::InstantPopup); renderMode->setObjectName(tr("renderMode")); QMenu * renderModeMenu = new QMenu(renderMode); renderModeMenu->addAction(new QAction(tr("RGB"), renderModeMenu)); renderModeMenu->addAction(new QAction(tr("Alpha"), renderModeMenu)); renderModeMenu->addAction(new QAction(tr("OverDraw"), renderModeMenu)); renderModeMenu->addAction(new QAction(tr("Mipmaps"), renderModeMenu)); connect(renderModeMenu, SIGNAL(triggered(QAction *)), this, SLOT(renderModeMenuPressed(QAction *))); renderMode->setMenu(renderModeMenu); m_pToolbar->addWidget(renderMode); QMetaObject::invokeMethod(renderModeMenu, "triggered", Q_ARG(QAction *, *renderModeMenu->actions().begin())); m_pToolbar->addSeparator(); m_pToolbar->addWidget(new QLabel()); m_pToolbar->addSeparator(); QPushButton * pLightingButton = new QPushButton(); pLightingButton->setCheckable(true); //pLightingButton->setText(tr("Lighting")); pLightingButton->setIcon(QIcon("Aqua100.png")); m_pToolbar->addWidget(pLightingButton); m_pToolbar->addSeparator(); QPushButton * pGameOverlayButton = new QPushButton(); pGameOverlayButton->setCheckable(true); pGameOverlayButton->setIcon(QIcon("Aqua100.png")); //pGameOverlayButton->setMinimumHeight(TOOLBAR_MIN_HEIGHT); m_pToolbar->addWidget(pGameOverlayButton); m_pToolbar->addSeparator(); QPushButton * pAuditionButton = new QPushButton(); pAuditionButton->setCheckable(true); pAuditionButton->setIcon(QIcon("Aqua100.png")); //pAuditionButton->setMinimumHeight(TOOLBAR_MIN_HEIGHT); m_pToolbar->addWidget(pAuditionButton); m_pToolbar->addSeparator(); //╟я©ь╪Ч╪╥╣╫ср╠ъ QWidget * space = new QWidget(); space->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_pToolbar->addWidget(space); m_pToolbar->addSeparator(); QPushButton * gizmos = new QPushButton(); gizmos->setText(tr("Gizmos")); m_pToolbar->addWidget(gizmos); m_pToolbar->addSeparator(); QLineEdit * searchEdit = new QLineEdit(); m_pToolbar->addWidget(searchEdit); }
FindBar::FindBar(QWidget *parent) : QWidget(parent) , m_lineEdit(new QLineEdit(this)) , m_matchCase(new QCheckBox(tr("&Match case"), this)) , m_highlightAll(new QCheckBox(tr("&Highlight all"), this)), m_associatedWebView(0) { QHBoxLayout *layout = new QHBoxLayout; // cosmetic layout->setContentsMargins(2, 0, 2, 0); // hide button QToolButton *hideButton = new QToolButton(this); hideButton->setAutoRaise(true); hideButton->setIcon(QIcon::fromTheme(QLatin1String("dialog-close"))); hideButton->setShortcut(tr("Esc")); connect(hideButton, SIGNAL(clicked()), this, SLOT(hide())); layout->addWidget(hideButton); layout->setAlignment(hideButton, Qt::AlignLeft | Qt::AlignTop); // label QLabel *label = new QLabel(tr("Find:")); layout->addWidget(label); // Find Bar signal connect(this, SIGNAL(searchString(QString)), this, SLOT(find(QString))); // lineEdit, focusProxy setFocusProxy(m_lineEdit); m_lineEdit->setMaximumWidth(250); connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(find(QString))); layout->addWidget(m_lineEdit); // buttons QPushButton *findNext = new QPushButton(QIcon::fromTheme(QLatin1String("go-down")), tr("&Next"), this); findNext->setShortcut(tr("F3")); QPushButton *findPrev = new QPushButton(QIcon::fromTheme(QLatin1String("go-up")), tr("&Previous"), this); findPrev->setShortcut(tr("Shift+F3")); connect(findNext, SIGNAL(clicked()), this, SLOT(findNext())); connect(findPrev, SIGNAL(clicked()), this, SLOT(findPrevious())); layout->addWidget(findNext); layout->addWidget(findPrev); // Case sensitivity. Deliberately set so this is off by default. m_matchCase->setCheckState(Qt::Unchecked); m_matchCase->setTristate(false); connect(m_matchCase, SIGNAL(toggled(bool)), this, SLOT(matchCaseUpdate())); layout->addWidget(m_matchCase); // Hightlight All. On by default m_highlightAll->setCheckState(Qt::Checked); m_highlightAll->setTristate(false); connect(m_highlightAll, SIGNAL(toggled(bool)), this, SLOT(updateHighlight())); layout->addWidget(m_highlightAll); // stretching widget on the left layout->addStretch(); setLayout(layout); // we start off hidden hide(); }
AddLayerModelWidget::AddLayerModelWidget(SlotInspectorSection* parentSlot) : QWidget {parentSlot} { QHBoxLayout* layout = new QHBoxLayout; layout->setContentsMargins(0, 0, 0 , 0); this->setLayout(layout); // Button QToolButton* addButton = new QToolButton; addButton->setText("+"); // Text auto addText = new QLabel("Add Process View"); addText->setStyleSheet(QString("text-align : left;")); layout->addWidget(addButton); layout->addWidget(addText); connect(addButton, &QToolButton::pressed, [ = ]() { QStringList available_models; // 1. List the processes in the model. auto shared_process_list = parentSlot->model().parentConstraint().processes(); // 2. List the processes that already have a view in this slot auto already_displayed_processes = parentSlot->model().layerModels(); // 3. Compute the difference for(auto& process : shared_process_list) { auto it = std::find_if(std::begin(already_displayed_processes), std::end(already_displayed_processes), [&process](LayerModel * lm) { return lm->sharedProcessModel().id() == process->id(); }); if(it == std::end(already_displayed_processes)) { available_models += QString::number(*process->id().val()); } } // 4. Present a dialog with the availble id's if(available_models.size() > 0) { bool ok = false; auto process_name = QInputDialog::getItem( this, QObject::tr("Choose a process id"), QObject::tr("Choose a process id"), available_models, 0, false, &ok); if(ok) parentSlot->createLayerModel(id_type<ProcessModel> {process_name.toInt() }); } }); }
TabWidget::TabWidget(QWidget *parent) : QTabWidget(parent) , m_recentlyClosedTabsAction(0) , m_newTabAction(0) , m_closeTabAction(0) , m_nextTabAction(0) , m_previousTabAction(0) , m_recentlyClosedTabsMenu(0) , m_lineEditCompleter(0) , m_lineEdits(0) , m_tabBar(new TabBar(this)) { setElideMode(Qt::ElideRight); new QShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_T), this, SLOT(openLastTab())); connect(m_tabBar, SIGNAL(loadUrl(const QUrl&, TabWidget::Tab)), this, SLOT(loadUrl(const QUrl&, TabWidget::Tab))); connect(m_tabBar, SIGNAL(newTab()), this, SLOT(newTab())); connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int))); connect(m_tabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int))); connect(m_tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int))); connect(m_tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int))); connect(m_tabBar, SIGNAL(reloadAllTabs()), this, SLOT(reloadAllTabs())); #if QT_VERSION < 0x040500 connect(m_tabBar, SIGNAL(tabMoveRequested(int, int)), this, SLOT(moveTab(int, int))); #endif setTabBar(m_tabBar); #if QT_VERSION >= 0x040500 setDocumentMode(true); connect(m_tabBar, SIGNAL(tabMoved(int, int)), this, SLOT(moveTab(int, int))); #endif // Actions m_newTabAction = new QAction(tr("New &Tab"), this); m_newTabAction->setShortcuts(QKeySequence::AddTab); connect(m_newTabAction, SIGNAL(triggered()), this, SLOT(newTab())); m_closeTabAction = new QAction(tr("&Close Tab"), this); m_closeTabAction->setShortcuts(QKeySequence::Close); connect(m_closeTabAction, SIGNAL(triggered()), this, SLOT(closeTab())); #if QT_VERSION < 0x040500 m_newTabAction->setIcon(QIcon(QLatin1String(":addtab.png"))); m_newTabAction->setIconVisibleInMenu(false); m_closeTabAction->setIcon(QIcon(QLatin1String(":closetab.png"))); m_closeTabAction->setIconVisibleInMenu(false); #endif m_nextTabAction = new QAction(tr("Show Next Tab"), this); QList<QKeySequence> shortcuts; shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BraceRight)); shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_PageDown)); shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BracketRight)); shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_Less)); shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_Tab)); m_nextTabAction->setShortcuts(shortcuts); connect(m_nextTabAction, SIGNAL(triggered()), this, SLOT(nextTab())); m_previousTabAction = new QAction(tr("Show Previous Tab"), this); shortcuts.clear(); shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BraceLeft)); shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_PageUp)); shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BracketLeft)); shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_Greater)); shortcuts.append(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_Tab)); m_previousTabAction->setShortcuts(shortcuts); connect(m_previousTabAction, SIGNAL(triggered()), this, SLOT(previousTab())); m_recentlyClosedTabsMenu = new QMenu(this); connect(m_recentlyClosedTabsMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowRecentTabsMenu())); connect(m_recentlyClosedTabsMenu, SIGNAL(triggered(QAction *)), this, SLOT(aboutToShowRecentTriggeredAction(QAction *))); m_recentlyClosedTabsAction = new QAction(tr("Recently Closed Tabs"), this); m_recentlyClosedTabsAction->setMenu(m_recentlyClosedTabsMenu); m_recentlyClosedTabsAction->setEnabled(false); #if QT_VERSION >= 0x040500 m_tabBar->setTabsClosable(true); connect(m_tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); m_tabBar->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab); #else // corner buttons QToolButton *addTabButton = new QToolButton(this); addTabButton->setDefaultAction(m_newTabAction); addTabButton->setAutoRaise(true); addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); setCornerWidget(addTabButton, Qt::TopLeftCorner); QToolButton *closeTabButton = new QToolButton(this); closeTabButton->setDefaultAction(m_closeTabAction); closeTabButton->setAutoRaise(true); closeTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); setCornerWidget(closeTabButton, Qt::TopRightCorner); #endif connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int))); m_lineEdits = new QStackedWidget(this); connect(BrowserApplication::historyManager(), SIGNAL(historyCleared()), this, SLOT(historyCleared())); }
VectorizerPopup::VectorizerPopup(QWidget *parent, Qt::WFlags flags) #endif : Dialog(TApp::instance()->getMainWindow(), true, false, "Vectorizer"), m_sceneHandle(TApp::instance()->getCurrentScene()) { struct Locals { int m_bit; Locals() : m_bit() {} static void addParameterGroup( std::vector<ParamGroup> ¶mGroups, int group, int startRow, int separatorRow = -1) { assert(group <= paramGroups.size()); if (group == paramGroups.size()) paramGroups.push_back(ParamGroup(startRow, separatorRow)); } void addParameter( std::vector<ParamGroup> ¶mGroups, const QString ¶mName) { paramGroups.back().m_params.push_back(Param(paramName, m_bit++)); } } locals; // Su MAC i dialog modali non hanno bottoni di chiusura nella titleBar setModal(false); setWindowTitle(tr("Convert-to-Vector Settings")); setLabelWidth(125); setTopMargin(0); setTopSpacing(0); // Build vertical layout beginVLayout(); QSplitter *splitter = new QSplitter(Qt::Vertical, this); splitter->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); addWidget(splitter); QToolBar *leftToolBar = new QToolBar, *rightToolBar = new QToolBar; { QWidget *toolbarsContainer = new QWidget(this); toolbarsContainer->setFixedHeight(22); addWidget(toolbarsContainer); QHBoxLayout *toolbarsLayout = new QHBoxLayout(toolbarsContainer); toolbarsContainer->setLayout(toolbarsLayout); toolbarsLayout->setMargin(0); toolbarsLayout->setSpacing(0); QToolBar *spacingToolBar = new QToolBar(toolbarsContainer); // The spacer object must be a toolbar. spacingToolBar->setFixedHeight(22); // It's related to qss choices... I know it's stinky toolbarsLayout->addWidget(leftToolBar, 0, Qt::AlignLeft); toolbarsLayout->addWidget(spacingToolBar, 1); toolbarsLayout->addWidget(rightToolBar, 0, Qt::AlignRight); } endVLayout(); // Build parameters area QScrollArea *paramsArea = new QScrollArea(splitter); paramsArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); paramsArea->setWidgetResizable(true); splitter->addWidget(paramsArea); splitter->setStretchFactor(0, 1); m_paramsWidget = new QFrame(paramsArea); paramsArea->setWidget(m_paramsWidget); m_paramsLayout = new QGridLayout; m_paramsWidget->setLayout(m_paramsLayout); int group = 0, row = 0; locals.addParameterGroup(::l_centerlineParamGroups, group, row); locals.addParameterGroup(::l_outlineParamGroups, group++, row); // Vectorization mode m_typeMenu = new QComboBox(this); m_typeMenu->setFixedSize(245, WidgetHeight); QStringList formats; formats << tr("Centerline") << tr("Outline"); m_typeMenu->addItems(formats); m_typeMenu->setMinimumHeight(WidgetHeight); bool isOutline = m_sceneHandle->getScene()->getProperties()->getVectorizerParameters()->m_isOutline; m_typeMenu->setCurrentIndex(isOutline ? 1 : 0); connect(m_typeMenu, SIGNAL(currentIndexChanged(int)), this, SLOT(onTypeChange(int))); m_paramsLayout->addWidget(new QLabel(tr("Mode")), row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_typeMenu, row++, 1); locals.addParameter(l_centerlineParamGroups, tr("Mode")); locals.addParameter(l_outlineParamGroups, tr("Mode")); //-------------------- Parameters area - Centerline ------------------------ locals.addParameterGroup(l_centerlineParamGroups, group++, row); // Threshold m_cThresholdLabel = new QLabel(tr("Threshold")); m_cThreshold = new IntField(this); m_paramsLayout->addWidget(m_cThresholdLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_cThreshold, row++, 1); locals.addParameter(l_centerlineParamGroups, tr("Threshold")); // Accuracy m_cAccuracyLabel = new QLabel(tr("Accuracy")); m_cAccuracy = new IntField(this); m_paramsLayout->addWidget(m_cAccuracyLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_cAccuracy, row++, 1); locals.addParameter(l_centerlineParamGroups, tr("Accuracy")); // Despeckling m_cDespecklingLabel = new QLabel(tr("Despeckling")); m_cDespeckling = new IntField(this); m_paramsLayout->addWidget(m_cDespecklingLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_cDespeckling, row++, 1); locals.addParameter(l_centerlineParamGroups, tr("Despeckling")); // Max Thickness m_cMaxThicknessLabel = new QLabel(tr("Max Thickness")); m_paramsLayout->addWidget(m_cMaxThicknessLabel, row, 0, Qt::AlignRight); m_cMaxThickness = new IntField(this); m_cMaxThickness->enableSlider(false); m_paramsLayout->addWidget(m_cMaxThickness, row++, 1, Qt::AlignLeft); locals.addParameter(l_centerlineParamGroups, tr("Max Thickness")); // Thickness Calibration m_cThicknessRatioLabel = new QLabel(tr("Thickness Calibration")); m_paramsLayout->addWidget(m_cThicknessRatioLabel, row, 0, Qt::AlignRight); /*m_cThicknessRatio = new IntField(this); paramsLayout->addWidget(m_cThicknessRatio, row++, 1);*/ QHBoxLayout *cThicknessRatioLayout = new QHBoxLayout; cThicknessRatioLayout->addSpacing(20); m_cThicknessRatioFirstLabel = new QLabel(tr("Start:")); cThicknessRatioLayout->addWidget(m_cThicknessRatioFirstLabel); m_cThicknessRatioFirst = new MeasuredDoubleLineEdit(this); m_cThicknessRatioFirst->setMeasure("percentage"); cThicknessRatioLayout->addWidget(m_cThicknessRatioFirst); m_cThicknessRatioLastLabel = new QLabel(tr("End:")); cThicknessRatioLayout->addWidget(m_cThicknessRatioLastLabel); m_cThicknessRatioLast = new MeasuredDoubleLineEdit(this); m_cThicknessRatioLast->setMeasure("percentage"); cThicknessRatioLayout->addWidget(m_cThicknessRatioLast); cThicknessRatioLayout->addStretch(1); m_paramsLayout->addLayout(cThicknessRatioLayout, row++, 1); locals.addParameter(l_centerlineParamGroups, tr("Thickness Calibration")); // Checkboxes { static const QString name = tr("Preserve Painted Areas"); locals.addParameter(l_centerlineParamGroups, name); m_cPaintFill = new CheckBox(name, this); m_cPaintFill->setFixedHeight(WidgetHeight); m_paramsLayout->addWidget(m_cPaintFill, row++, 1); } { static const QString name = tr("Add Border"); locals.addParameter(l_centerlineParamGroups, name); m_cMakeFrame = new CheckBox(name, this); m_cMakeFrame->setFixedHeight(WidgetHeight); m_paramsLayout->addWidget(m_cMakeFrame, row++, 1); } locals.addParameterGroup(l_centerlineParamGroups, group++, row + 1, row); m_cNaaSourceSeparator = new Separator(tr("Full color non-AA images")); m_paramsLayout->addWidget(m_cNaaSourceSeparator, row++, 0, 1, 2); { static const QString name = tr("Enhanced ink recognition"); locals.addParameter(l_centerlineParamGroups, name); m_cNaaSource = new CheckBox(name, this); m_cNaaSource->setFixedHeight(WidgetHeight); m_paramsLayout->addWidget(m_cNaaSource, row++, 1); } //-------------------- Parameters area - Outline ------------------------ group = 1; locals.addParameterGroup(l_outlineParamGroups, group++, row); //Accuracy m_oAccuracyLabel = new QLabel(tr("Accuracy")); m_oAccuracy = new IntField(this); m_paramsLayout->addWidget(m_oAccuracyLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_oAccuracy, row++, 1); locals.addParameter(l_outlineParamGroups, tr("Accuracy")); //Despeckling m_oDespecklingLabel = new QLabel(tr("Despeckling")); m_oDespeckling = new IntField(this); m_paramsLayout->addWidget(m_oDespecklingLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_oDespeckling, row++, 1); locals.addParameter(l_outlineParamGroups, tr("Despeckling")); //Paint Fill { static const QString name = tr("Preserve Painted Areas"); locals.addParameter(l_outlineParamGroups, name); m_oPaintFill = new CheckBox(name, this); m_oPaintFill->setFixedHeight(WidgetHeight); m_paramsLayout->addWidget(m_oPaintFill, row++, 1); } locals.addParameterGroup(l_outlineParamGroups, group++, row + 1, row); m_oCornersSeparator = new Separator(tr("Corners")); m_paramsLayout->addWidget(m_oCornersSeparator, row++, 0, 1, 2); //Adherence m_oAdherenceLabel = new QLabel(tr("Adherence")); m_oAdherence = new IntField(this); m_paramsLayout->addWidget(m_oAdherenceLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_oAdherence, row++, 1); locals.addParameter(l_outlineParamGroups, tr("Adherence")); //Angle m_oAngleLabel = new QLabel(tr("Angle")); m_oAngle = new IntField(this); m_paramsLayout->addWidget(m_oAngleLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_oAngle, row++, 1); locals.addParameter(l_outlineParamGroups, tr("Angle")); //Relative m_oRelativeLabel = new QLabel(tr("Curve Radius")); m_oRelative = new IntField(this); m_paramsLayout->addWidget(m_oRelativeLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_oRelative, row++, 1); locals.addParameter(l_outlineParamGroups, tr("Curve Radius")); locals.addParameterGroup(l_outlineParamGroups, group++, row + 1, row); m_oFullColorSeparator = new Separator(tr("Raster Levels")); m_paramsLayout->addWidget(m_oFullColorSeparator, row++, 0, 1, 2); //Max Colors m_oMaxColorsLabel = new QLabel(tr("Max Colors")); m_oMaxColors = new IntField(this); m_paramsLayout->addWidget(m_oMaxColorsLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_oMaxColors, row++, 1); locals.addParameter(l_outlineParamGroups, tr("Max Colors")); //Transparent Color m_oTransparentColorLabel = new QLabel(tr("Transparent Color"), this); m_oTransparentColor = new ColorField(this, true, TPixel32::Transparent, 48); m_paramsLayout->addWidget(m_oTransparentColorLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_oTransparentColor, row++, 1); locals.addParameter(l_outlineParamGroups, tr("Transparent Color")); locals.addParameterGroup(l_outlineParamGroups, group++, row + 1, row); m_oTlvSeparator = new Separator(tr("TLV Levels")); m_paramsLayout->addWidget(m_oTlvSeparator, row++, 0, 1, 2); //Tone Threshold m_oToneThresholdLabel = new QLabel(tr("Tone Threshold")); m_oToneThreshold = new IntField(this); m_paramsLayout->addWidget(m_oToneThresholdLabel, row, 0, Qt::AlignRight); m_paramsLayout->addWidget(m_oToneThreshold, row++, 1); locals.addParameter(l_outlineParamGroups, tr("Tone Threshold")); m_paramsLayout->setRowStretch(row, 1); //-------------------- Swatch area ------------------------ m_swatchArea = new VectorizerSwatchArea(this); splitter->addWidget(m_swatchArea); m_swatchArea->setEnabled(false); //Initally not enabled connect(this, SIGNAL(valuesChanged()), m_swatchArea, SLOT(invalidateContents())); //---------------------- Toolbar -------------------------- QAction *swatchAct = new QAction(createQIconOnOffPNG("preview", true), tr("Toggle Swatch Preview"), this); swatchAct->setCheckable(true); leftToolBar->addAction(swatchAct); QAction *centerlineAct = new QAction(createQIconOnOffPNG("opacitycheck", true), tr("Toggle Centerlines Check"), this); centerlineAct->setCheckable(true); leftToolBar->addAction(centerlineAct); QToolButton *visibilityButton = new QToolButton(this); visibilityButton->setIcon(createQIconPNG("options")); visibilityButton->setPopupMode(QToolButton::InstantPopup); QMenu *visibilityMenu = new QMenu(visibilityButton); visibilityButton->setMenu(visibilityMenu); rightToolBar->addWidget(visibilityButton); rightToolBar->addSeparator(); QAction *saveAct = new QAction(createQIconOnOffPNG("save", false), tr("Save Settings"), this); rightToolBar->addAction(saveAct); QAction *loadAct = new QAction(createQIconOnOffPNG("load", false), tr("Load Settings"), this); rightToolBar->addAction(loadAct); rightToolBar->addSeparator(); QAction *resetAct = new QAction(createQIconOnOffPNG("resetsize", false), tr("Reset Settings"), this); rightToolBar->addAction(resetAct); connect(swatchAct, SIGNAL(triggered(bool)), m_swatchArea, SLOT(enablePreview(bool))); connect(centerlineAct, SIGNAL(triggered(bool)), m_swatchArea, SLOT(enableDrawCenterlines(bool))); connect(visibilityMenu, SIGNAL(aboutToShow()), this, SLOT(populateVisibilityMenu())); connect(saveAct, SIGNAL(triggered()), this, SLOT(saveParameters())); connect(loadAct, SIGNAL(triggered()), this, SLOT(loadParameters())); connect(resetAct, SIGNAL(triggered()), this, SLOT(resetParameters())); //------------------- Convert Button ---------------------- //Convert Button m_okBtn = new QPushButton(QString(tr("Convert")), this); connect(m_okBtn, SIGNAL(clicked()), this, SLOT(onOk())); addButtonBarWidget(m_okBtn); //All detailed signals convey to the unique valuesChanged() signal. That makes it easier //to disconnect update notifications whenever we loadConfiguration(..). connect(this, SIGNAL(valuesChanged()), this, SLOT(updateSceneSettings())); //Connect value changes to update the global VectorizerPopUpSettingsContainer. //connect(m_typeMenu,SIGNAL(currentIndexChanged(const QString &)),this,SLOT(updateSceneSettings())); connect(m_cThreshold, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_cAccuracy, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_cDespeckling, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_cMaxThickness, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); //connect(m_cThicknessRatio,SIGNAL(valueChanged(bool)),this,SLOT(onValueEdited(bool))); connect(m_cThicknessRatioFirst, SIGNAL(valueChanged()), this, SLOT(onValueEdited())); connect(m_cThicknessRatioLast, SIGNAL(valueChanged()), this, SLOT(onValueEdited())); connect(m_cMakeFrame, SIGNAL(stateChanged(int)), this, SLOT(onValueEdited())); connect(m_cPaintFill, SIGNAL(stateChanged(int)), this, SLOT(onValueEdited())); connect(m_cNaaSource, SIGNAL(stateChanged(int)), this, SLOT(onValueEdited())); connect(m_oAccuracy, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_oDespeckling, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_oPaintFill, SIGNAL(stateChanged(int)), this, SLOT(onValueEdited())); connect(m_oAdherence, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_oAngle, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_oRelative, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_oDespeckling, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_oMaxColors, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); connect(m_oTransparentColor, SIGNAL(colorChanged(const TPixel32 &, bool)), this, SLOT(onValueEdited(const TPixel32 &, bool))); connect(m_oToneThreshold, SIGNAL(valueChanged(bool)), this, SLOT(onValueEdited(bool))); refreshPopup(); //Non e' corretto: manca la possibilita' di aggiornare la selezione del livello corrente // connect(TApp::instance()->getCurrentLevel(), SIGNAL(xshLevelChanged()), // this, SLOT(updateValues())); }
bool MsgEdit::sendMessage(Message *msg) { if (m_retry.msg){ delete m_retry.msg; m_retry.msg = NULL; } if (m_msg){ delete msg; Event e(EventMessageCancel, m_msg); if (e.process()) m_msg = NULL; stopSend(false); return false; } bool bClose = true; if (CorePlugin::m_plugin->getContainerMode()){ bClose = false; Command cmd; cmd->id = CmdSendClose; cmd->param = this; Event e(EventCommandWidget, cmd); QToolButton *btnClose = (QToolButton*)(e.process()); if (btnClose) bClose = btnClose->isOn(); } CorePlugin::m_plugin->setCloseSend(bClose); Contact *contact = getContacts()->contact(m_userWnd->id()); if (contact){ TranslitUserData *data = (TranslitUserData*)(contact->getUserData(CorePlugin::m_plugin->translit_data_id)); if (data && data->Translit) msg->setFlags(msg->getFlags() | MESSAGE_TRANSLIT); } msg->setFlags(msg->getFlags() | m_flags); m_flags = 0; if (m_userWnd->m_list){ multiply = m_userWnd->m_list->selected; if (multiply.empty()) return false; multiply_it = multiply.begin(); msg->setContact(*multiply_it); msg->setClient(NULL); ++multiply_it; if (multiply_it != multiply.end()) msg->setFlags(msg->getFlags() | MESSAGE_MULTIPLY); } editLostFocus(); Command cmd; cmd->id = CmdSend; cmd->text = I18N_NOOP("Cancel"); cmd->icon = "cancel"; cmd->flags = BTN_PICT; cmd->param = this; Event eCmd(EventCommandChange, cmd); eCmd.process(); m_msg = msg; return send(); }
/********************************************************************** * Speed control widget **********************************************************************/ SpeedControlWidget::SpeedControlWidget( intf_thread_t *_p_i, QWidget *_parent ) : QFrame( _parent ), p_intf( _p_i ) { QSizePolicy sizePolicy( QSizePolicy::Fixed, QSizePolicy::Maximum ); sizePolicy.setHorizontalStretch( 0 ); sizePolicy.setVerticalStretch( 0 ); speedSlider = new QSlider( this ); speedSlider->setSizePolicy( sizePolicy ); speedSlider->setMinimumSize( QSize( 140, 20 ) ); speedSlider->setOrientation( Qt::Horizontal ); speedSlider->setTickPosition( QSlider::TicksBelow ); speedSlider->setRange( -34, 34 ); speedSlider->setSingleStep( 1 ); speedSlider->setPageStep( 1 ); speedSlider->setTickInterval( 17 ); CONNECT( speedSlider, valueChanged( int ), this, updateRate( int ) ); QToolButton *normalSpeedButton = new QToolButton( this ); normalSpeedButton->setMaximumSize( QSize( 26, 16 ) ); normalSpeedButton->setAutoRaise( true ); normalSpeedButton->setText( "1x" ); normalSpeedButton->setToolTip( qtr( "Revert to normal play speed" ) ); CONNECT( normalSpeedButton, clicked(), this, resetRate() ); QToolButton *slowerButton = new QToolButton( this ); slowerButton->setMaximumSize( QSize( 26, 16 ) ); slowerButton->setAutoRaise( true ); slowerButton->setToolTip( tooltipL[SLOWER_BUTTON] ); slowerButton->setIcon( QIcon( iconL[SLOWER_BUTTON] ) ); CONNECT( slowerButton, clicked(), THEMIM->getIM(), slower() ); QToolButton *fasterButton = new QToolButton( this ); fasterButton->setMaximumSize( QSize( 26, 16 ) ); fasterButton->setAutoRaise( true ); fasterButton->setToolTip( tooltipL[FASTER_BUTTON] ); fasterButton->setIcon( QIcon( iconL[FASTER_BUTTON] ) ); CONNECT( fasterButton, clicked(), THEMIM->getIM(), faster() ); /* spinBox = new QDoubleSpinBox(); spinBox->setDecimals( 2 ); spinBox->setMaximum( 32 ); spinBox->setMinimum( 0.03F ); spinBox->setSingleStep( 0.10F ); spinBox->setAlignment( Qt::AlignRight ); CONNECT( spinBox, valueChanged( double ), this, updateSpinBoxRate( double ) ); */ QGridLayout* speedControlLayout = new QGridLayout( this ); speedControlLayout->addWidget( speedSlider, 0, 0, 1, 3 ); speedControlLayout->addWidget( slowerButton, 1, 0 ); speedControlLayout->addWidget( normalSpeedButton, 1, 1, 1, 1, Qt::AlignRight ); speedControlLayout->addWidget( fasterButton, 1, 2, 1, 1, Qt::AlignRight ); //speedControlLayout->addWidget( spinBox ); speedControlLayout->setContentsMargins( 0, 0, 0, 0 ); speedControlLayout->setSpacing( 0 ); lastValue = 0; activateOnState(); }
CCustomer::CCustomer(QWidget *parent) : QWidget(parent) , actualRecords(false) , ui(new Ui::CCustomer) , customerDialog(new CCustomerDialog(this)), customer_gDialog(new CCustomer_gDialog(this)) , discountDialog(new CDiscountDialog(this)) , addItem(new CAddItem(this)) , focusedWidget(nullptr) { ui->setupUi(this); // model modelFaces = new QStandardItemModel(this); modelPartner = new QStandardItemModel(this); modelHuman = new QStandardItemModel(this); modelSelectionFaces = new QItemSelectionModel(modelFaces); modelSelectionPartner = new QItemSelectionModel(modelPartner); modelSelectionHuman = new QItemSelectionModel(modelHuman); // create #temporary table QString query ("SELECT * INTO #GroupCustomerDiscounts FROM ViewGroupCustomerDiscounts" "SELECT * INTO #CustomerSubdiller FROM ViewCustomerSubdiller"); QSqlQuery temporary(currentDatabase()); temporary.exec(query); QSplitter *hSplitter = new QSplitter(Qt::Horizontal); QSplitter *vSplitter = new QSplitter(Qt::Vertical); QWidget *w1 = new QWidget(this); QWidget *w2 = new QWidget(this); treeFaces = new QTreeView (this); treePartner = new CCustomerTreeView (this); textEditPartnerComment = new QTextEdit (this); textEditPartnerComment->setMaximumWidth(100); textEditPartnerComment->setReadOnly(true); treeHuman = new CCustomerTreeView (this); textEditHumanComment = new QTextEdit (this); textEditHumanComment->setMaximumWidth(100); textEditHumanComment->setReadOnly(true); QHBoxLayout *hboxPartner = new QHBoxLayout(w1); hboxPartner->setMargin(0); hboxPartner->addWidget(treePartner); hboxPartner->addWidget(textEditPartnerComment); QHBoxLayout *hboxHuman = new QHBoxLayout(w2); hboxHuman->setMargin(0); hboxHuman->addWidget(treeHuman); hboxHuman->addWidget(textEditHumanComment); vSplitter->addWidget(w1); vSplitter->addWidget(w2); vSplitter->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); ui->vLayoutUnionPartnerHuman->addWidget(vSplitter); hSplitter->addWidget(treeFaces); hSplitter->addWidget(vSplitter); hSplitter->setStretchFactor(1, 3); hSplitter->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); ui->hLayoutUnionViews->addWidget(hSplitter); treeFaces->setObjectName("treeViewFaces"); treeFaces->setModel(modelFaces); treeFaces->setSelectionModel(modelSelectionFaces); treeFaces->setEditTriggers(QAbstractItemView::NoEditTriggers); treeFaces->installEventFilter(this); treePartner->setObjectName("treeViewPartner"); treePartner->setRootIsDecorated(false); treePartner->setAlternatingRowColors(true); treePartner->setModel(modelPartner); treePartner->setSelectionModel(modelSelectionPartner); treePartner->setEditTriggers(QAbstractItemView::NoEditTriggers); treePartner->installEventFilter(this); treeHuman->setObjectName("treeViewHuman"); treeHuman->setRootIsDecorated(false); treeHuman->setAlternatingRowColors(true); treeHuman->setModel(modelHuman); treeHuman->setSelectionModel(modelSelectionHuman); treeHuman->setEditTriggers(QAbstractItemView::NoEditTriggers); treeHuman->installEventFilter(this); filter = new CFilter(this); filter->setObjectName("filter"); filter->setPlaceholderText("Введите наименование"); filter->installEventFilter(this); filter->setValidator(new QRegExpValidator(QRegExp(trUtf8("[а-яА-Яa-zA-Z0-9_]+")), this)); ui->hLayoutSearchToItem->addWidget(filter); QToolButton *telephone = new QToolButton(this); QPixmap pixmapTelephone("data/picture/additionally/telephone.png"); telephone->setIcon(QIcon(pixmapTelephone)); telephone->setIconSize(QSize(24, 24)); telephone->setCursor(Qt::PointingHandCursor); telephone->setStyleSheet("QToolButton { border: none; padding: 0px; }"); ui->hLayoutSearchToItem->addWidget(telephone); QToolButton *meeting = new QToolButton(this); QPixmap pixmapMeeting("data/picture/additionally/meeting.png"); meeting->setIcon(QIcon(pixmapMeeting)); meeting->setIconSize(QSize(24, 24)); meeting->setCursor(Qt::PointingHandCursor); meeting->setStyleSheet("QToolButton { border: none; padding: 0px; }"); ui->hLayoutSearchToItem->addWidget(meeting); QToolButton *event = new QToolButton(this); QPixmap pixmapEvent("data/picture/additionally/event.png"); event->setIcon(QIcon(pixmapEvent)); event->setIconSize(QSize(24, 24)); event->setCursor(Qt::PointingHandCursor); event->setStyleSheet("QToolButton { border: none; padding: 0px; }"); ui->hLayoutSearchToItem->addWidget(event); QToolButton *task = new QToolButton(this); QPixmap pixmapTask("data/picture/additionally/task.png"); task->setIcon(QIcon(pixmapTask)); task->setIconSize(QSize(24, 24)); task->setCursor(Qt::PointingHandCursor); task->setStyleSheet("QToolButton { border: none; padding: 0px; }"); ui->hLayoutSearchToItem->addWidget(task); ui->labelCurrentUser->setText(QString("Пользователь: <b><u>" + currentUser() + "</u></b>")); mc.idCustomer = -1; mc.nameCustomer = QString(""); root = new QStandardItem(QString("Заказчики")); root->setIcon(QIcon("data/picture/additionally/root.png")); modelFaces->insertColumns(0, FACES_MODEL_COLUMN_COUNT); modelFaces->setItem(0, 0, root); QFont font(treeFaces->font()); font.setBold (true); modelFaces->setData(modelFaces->index(0, 0), font, Qt::FontRole); modelFaces->setHeaderData(0, Qt::Horizontal, QObject::tr("Наименование")); QVector<int> storage; storage.append(1); storage.append(2); storage.append(3); CDictionaryCore::columnHidden(treeFaces, modelFaces, storage); storage.clear(); root->setChild(modelFaces->rowCount(root->index()), new QStandardItem("Загрузка...")); modelPartner->insertColumns(0, PARTNER_MODEL_COLUMN_COUNT); modelPartner->setHeaderData(0, Qt::Horizontal, "Контрагенты"); modelPartner->setHeaderData(1, Qt::Horizontal, "Клиентский №"); modelPartner->setHeaderData(2, Qt::Horizontal, "Телефон"); modelPartner->setHeaderData(3, Qt::Horizontal, "Город"); modelPartner->setHeaderData(4, Qt::Horizontal, "Web"); modelPartner->setHeaderData(5, Qt::Horizontal, "Руководитель"); modelHuman->insertColumns(0, HUMAN_MODEL_COLUMN_COUNT); modelHuman->setHeaderData(0, Qt::Horizontal, "ФИО"); modelHuman->setHeaderData(1, Qt::Horizontal, "Отдел"); modelHuman->setHeaderData(2, Qt::Horizontal, "Должность"); modelHuman->setHeaderData(3, Qt::Horizontal, "Телефон"); modelHuman->setHeaderData(4, Qt::Horizontal, "Приоритет"); // connect(filter, SIGNAL(textChanged(QString)), SLOT(slotFindCities(QString))); connect(treeFaces, SIGNAL(expanded(QModelIndex)), SLOT(slotFillGroup(QModelIndex))); connect(treeFaces, SIGNAL(collapsed(QModelIndex)), SLOT(slotClearGroup(QModelIndex))); connect(treeFaces, SIGNAL(clicked(QModelIndex)), SLOT(slotFillPartner(QModelIndex))); // connect(treeViewCountry, SIGNAL(clicked(QModelIndex)), // this, SLOT(slotDataChanged(QModelIndex))); // connect(editDialogCountry, SIGNAL(saveDataChanged()), this, SLOT(slotInsertOrUpdateRecords())); // connect(editDialogCity, SIGNAL(saveDataChanged()), this, SLOT(slotInsertOrUpdateRecords())); // connect(addItem->ui->buttonSave, SIGNAL(clicked()), countryDialog, SLOT(show())); connect(addItem->ui->buttonSave, SIGNAL(clicked()), SLOT(slotShowEditDialog())); connect(addItem->ui->buttonSave, SIGNAL(clicked()), addItem, SLOT(close())); actualRecords ? ui->labelViewState->setText(QString(tr("Отображаются записи: <b><u>Актуальные</u></b>"))) : ui->labelViewState->setText(QString(tr("Отображаются записи: <b><u>Все</u></b>"))); }