Beispiel #1
0
void MainWindow::deletecloseClicked()
{
    m_deleteActionDialogue->close();
    QSplitter *central = new QSplitter(Qt::Vertical, this);
    central->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    model = new PlotsModel(central);
    QLabel *label = new QLabel("Equation");
    textfield = new QLineEdit();
    QPushButton *plotb = new QPushButton();
    plotb->setText("Plot");
    PlotsView3D *view3d = new PlotsView3D();
    sfactory = PlotsFactory::self();
    view3d->setUseSimpleRotation(args->isSet("simple-rotation"));
     view3d->setModel(model);
     QWidget *widget=new QWidget(this);
     QGridLayout *layout = new QGridLayout;
     layout->addWidget(label,0,0);
     layout->addWidget(textfield,0,1);
    layout->addWidget(plotb,0,2);
     layout->addWidget(view3d,1,0,1,3);
     widget->setLayout(layout);
     setCentralWidget(widget);
     widget->connect(plotb,SIGNAL(clicked()),this,SLOT(buttonclicked()));
     createDockWindows();
     random=0;
     setColorList();
     this->show();
}
Beispiel #2
0
//-----------------------------------------------------------------------------
// Function: AddressSpaceEditor::setupLayout()
//-----------------------------------------------------------------------------
void AddressSpaceEditor::setupLayout()
{
    QScrollArea* scrollArea = new QScrollArea(this);
    scrollArea->setWidgetResizable(true);
    scrollArea->setFrameShape(QFrame::NoFrame);

    QVBoxLayout* scrollLayout = new QVBoxLayout(this);
    scrollLayout->addWidget(scrollArea);
    scrollLayout->setContentsMargins(0, 0, 0, 0);

    QWidget* topWidget = new QWidget(scrollArea);
    topWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    QVBoxLayout* topLayout = new QVBoxLayout(topWidget);
    
    QHBoxLayout* nameAndGeneralLayout = new QHBoxLayout();
    nameAndGeneralLayout->addWidget(&nameEditor_, 0, Qt::AlignTop);
    nameAndGeneralLayout->addWidget(&generalEditor_);
    topLayout->addLayout(nameAndGeneralLayout);
    topLayout->addWidget(&segmentsEditor_, 1);
    topLayout->setContentsMargins(0, 0, 0, 0);

    QWidget* bottomWidget = new QWidget(scrollArea);
    bottomWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    QVBoxLayout* bottomLayout = new QVBoxLayout(bottomWidget);
    bottomLayout->addWidget(&localMemMapEditor_);
    bottomLayout->setContentsMargins(0, 0, 0, 0);

    QSplitter* verticalSplitter = new QSplitter(Qt::Vertical, scrollArea);
    verticalSplitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    verticalSplitter->addWidget(topWidget);
    verticalSplitter->addWidget(bottomWidget);
    verticalSplitter->setStretchFactor(1, 1);

    QSplitterHandle* handle = verticalSplitter->handle(1);
    QVBoxLayout* handleLayout = new QVBoxLayout(handle);
    handleLayout->setSpacing(0);
    handleLayout->setMargin(0);

    QFrame* line = new QFrame(handle);
    line->setLineWidth(2);
    line->setMidLineWidth(2);
    line->setFrameShape(QFrame::HLine);
    line->setFrameShadow(QFrame::Sunken);
    handleLayout->addWidget(line);

    verticalSplitter->setHandleWidth(10);

    scrollArea->setWidget(verticalSplitter);
}
Beispiel #3
0
MainWindow::MainWindow(KCmdLineArgs* args)
{
    this->setMinimumSize(640, 480);
    m_menu = new QMenu(this);
    QSplitter *central = new QSplitter(Qt::Vertical, this);
    central->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    m_model = new PlotsModel(central);
    m_size2=0;
    m_treeview = new QTreeView(this);
    QLabel *label = new QLabel("Equation",this);
    m_textfield = new QLineEdit(this);
    QPushButton *plotb = new QPushButton(this);
    plotb->setText("Plot");
    m_view3d = new PlotsView3D(this);
    m_sfactory = PlotsFactory::self();
    m_view3d->setUseSimpleRotation(args->isSet("simple-rotation"));
    QWidget *widget=new QWidget(this);
    m_listwidget = new QListWidget(this);
    m_listwidget->setVisible(false);
    m_listwidget2 = new QListWidget(this);
    m_listwidget2->setVisible(false);
    QGridLayout *layout = new QGridLayout;
    layout->addWidget(label,0,0);
    layout->addWidget(m_textfield,0,1);
    layout->addWidget(plotb,0,2);
    layout->addWidget(m_view3d,1,0,1,2);
    layout->addWidget(m_treeview,1,2);
    widget->setLayout(layout);
    setCentralWidget(widget);
    widget->connect(plotb,SIGNAL(clicked()),this,SLOT(buttonclicked()));
    m_random=0;
    m_size=0;
    setColorList();
    createActions();
    m_treeview->setModel(m_model);
    m_view3d->setModel(m_model);
    m_treeview->setEditTriggers(QAbstractItemView::AnyKeyPressed | QAbstractItemView::DoubleClicked);
    this->show();
}
AntialiasPopup::AntialiasPopup()
	: Dialog(TApp::instance()->getMainWindow(), true, false, "Antialias"), m_startRas(0)
{
	setWindowTitle(tr("Apply Antialias"));
	setLabelWidth(0);
	setModal(false);

	setTopMargin(0);
	setTopSpacing(0);

	beginVLayout();

	QSplitter *splitter = new QSplitter(Qt::Vertical);
	splitter->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
	addWidget(splitter);

	endVLayout();

	//------------------------- Top Layout --------------------------

	QScrollArea *scrollArea = new QScrollArea(splitter);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	scrollArea->setWidgetResizable(true);
	splitter->addWidget(scrollArea);
	splitter->setStretchFactor(0, 1);

	QFrame *topWidget = new QFrame(scrollArea);
	topWidget->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
	scrollArea->setWidget(topWidget);

	QGridLayout *topLayout = new QGridLayout(this);
	topWidget->setLayout(topLayout);

	//------------------------- Parameters --------------------------

	//Brightness
	QLabel *brightnessLabel = new QLabel(tr("Threshold:"));
	topLayout->addWidget(brightnessLabel, 0, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_thresholdField = new DVGui::IntField(topWidget);
	m_thresholdField->setRange(0, 255);
	m_thresholdField->setValue(40);
	topLayout->addWidget(m_thresholdField, 0, 1);

	//Contrast
	QLabel *contrastLabel = new QLabel(tr("Softness:"));
	topLayout->addWidget(contrastLabel, 1, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_softnessField = new DVGui::IntField(topWidget);
	m_softnessField->setRange(0, 100);
	m_softnessField->setValue(70);
	topLayout->addWidget(m_softnessField, 1, 1);

	topLayout->setRowStretch(2, 1);

	//--------------------------- Swatch ----------------------------

	m_viewer = new Swatch(splitter);
	m_viewer->setMinimumHeight(150);
	m_viewer->setFocusPolicy(Qt::WheelFocus);
	splitter->addWidget(m_viewer);

	//--------------------------- Button ----------------------------

	m_okBtn = new QPushButton(QString(tr("Apply")), this);
	connect(m_okBtn, SIGNAL(clicked()), this, SLOT(apply()));

	addButtonBarWidget(m_okBtn);

	//------------------------ Connections --------------------------

	TApp *app = TApp::instance();

	bool ret = true;

	ret = ret && connect(m_thresholdField, SIGNAL(valueChanged(bool)), this, SLOT(onValuesChanged(bool)));
	ret = ret && connect(m_softnessField, SIGNAL(valueChanged(bool)), this, SLOT(onValuesChanged(bool)));

	assert(ret);

	m_viewer->resize(0, 350);
	resize(600, 500);
}
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> &paramGroups,
			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> &paramGroups,
			const QString &paramName)
		{
			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()));
}
CleanupSettings::CleanupSettings(QWidget *parent)
	: QWidget(parent), m_attached(false)
{
	QVBoxLayout *vLayout = new QVBoxLayout(this);
	vLayout->setMargin(1); // NOTE: This works to show the 1-pix black border,
						   // because this is a QWidget (not QFrame) heir...
	setLayout(vLayout);

	//   Tabs Container
	// Used to deal with styled background and other stuff

	TabBarContainter *tabBarContainer = new TabBarContainter(this);
	QHBoxLayout *hLayout = new QHBoxLayout(tabBarContainer);

	hLayout->setMargin(0);
	hLayout->setAlignment(Qt::AlignLeft);
	hLayout->addSpacing(6);

	vLayout->addWidget(tabBarContainer);

	//  Tabs Bar

	DVGui::TabBar *tabBar = new DVGui::TabBar(this);
	hLayout->addWidget(tabBar);

	tabBar->addSimpleTab(tr("Cleanup"));
	tabBar->addSimpleTab(tr("Processing"));
	tabBar->addSimpleTab(tr("Camera"));
	tabBar->setDrawBase(false);

	//  Splitter

	QSplitter *split = new QSplitter(Qt::Vertical, this);
	split->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
	vLayout->addWidget(split);

	//  Stacked Widget

	QStackedWidget *stackedWidget = new QStackedWidget(split);
	stackedWidget->setMinimumWidth(300);
	//stackedWidget->setMinimumHeight(250);

	split->addWidget(stackedWidget);
	split->setStretchFactor(0, 1);

	//  Cleanup Tab

	QScrollArea *scrollArea = new QScrollArea(stackedWidget);
	stackedWidget->addWidget(scrollArea);

	scrollArea->setWidgetResizable(true);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

	m_cleanupTab = new CleanupTab;
	scrollArea->setWidget(m_cleanupTab);

	//  Processing Tab

	scrollArea = new QScrollArea(stackedWidget);
	stackedWidget->addWidget(scrollArea);

	scrollArea->setWidgetResizable(true);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

	m_processingTab = new ProcessingTab;
	scrollArea->setWidget(m_processingTab);

	//  Camera Tab

	scrollArea = new QScrollArea(stackedWidget);
	stackedWidget->addWidget(scrollArea);

	scrollArea->setWidgetResizable(true);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

	m_cameraTab = new CameraTab;
	scrollArea->setWidget(m_cameraTab);

	m_cameraTab->setCameraPresetListFile(ToonzFolder::getReslistPath(true));

	//  Swatch

	m_swatch = new CleanupSwatch(split, 200, 150);
	split->addWidget(m_swatch);

	//  ToolBar

	QWidget *toolBarWidget = new QWidget(this);
	vLayout->addWidget(toolBarWidget);

	toolBarWidget->setFixedHeight(22);

	QHBoxLayout *toolBarLayout = new QHBoxLayout(toolBarWidget);
	toolBarWidget->setLayout(toolBarLayout);

	toolBarLayout->setMargin(0);
	toolBarLayout->setSpacing(0);

	QToolBar *leftToolBar = new QToolBar(toolBarWidget);
	toolBarLayout->addWidget(leftToolBar, 0, Qt::AlignLeft);

	leftToolBar->setFixedWidth(110);

	m_swatchAct = new QAction(createQIconOnOffPNG("preview", true), tr("Toggle Swatch Preview"), this);
	m_swatchAct->setCheckable(true);
	leftToolBar->addAction(m_swatchAct);
	leftToolBar->addSeparator();

	m_opacityAct = new QAction(createQIconOnOffPNG("opacitycheck", true), tr("Toggle Opacity Check"), this);
	m_opacityAct->setCheckable(true);
	leftToolBar->addAction(m_opacityAct);

	QToolBar *spacingToolBar1 = new QToolBar(toolBarWidget);
	toolBarLayout->addWidget(spacingToolBar1, 1);

	spacingToolBar1->setMinimumHeight(22);

	QToolBar *rightToolBar = new QToolBar(toolBarWidget);
	toolBarLayout->addWidget(rightToolBar, 0, Qt::AlignRight);

	rightToolBar->setFixedWidth(110);

	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);

	//  Model-related stuff
	CleanupSettingsModel *model = CleanupSettingsModel::instance();
	m_backupParams.assign(model->getCurrentParameters(), false);

	//  Connections

	QAction *opacityCheckCmd = CommandManager::instance()->getAction(MI_OpacityCheck);
	assert(opacityCheckCmd);

	bool ret = true;
	ret = ret && connect(tabBar, SIGNAL(currentChanged(int)), stackedWidget, SLOT(setCurrentIndex(int)));
	ret = ret && connect(m_swatchAct, SIGNAL(toggled(bool)), SLOT(enableSwatch(bool)));
	ret = ret && connect(m_opacityAct, SIGNAL(triggered(bool)), opacityCheckCmd, SLOT(trigger()));
	ret = ret && connect(saveAct, SIGNAL(triggered()), model, SLOT(promptSave()));
	ret = ret && connect(loadAct, SIGNAL(triggered()), model, SLOT(promptLoad()));
	ret = ret && connect(resetAct, SIGNAL(triggered()), this, SLOT(onRestoreSceneSettings()));

	assert(ret);
}
MeshifyPopup::MeshifyPopup()
	: DVGui::Dialog(TApp::instance()->getMainWindow(), true, false, "MeshifyPopup"), m_r(-1), m_c(-1)
{
	setWindowTitle(tr("Create Mesh"));
	setLabelWidth(0);
	setModal(false);

	setTopMargin(0);
	setTopSpacing(0);

	beginVLayout();

	QSplitter *splitter = new QSplitter(Qt::Vertical);
	splitter->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
	addWidget(splitter);

	endVLayout();

	//------------------------- Top Layout --------------------------

	QScrollArea *scrollArea = new QScrollArea(splitter);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	scrollArea->setWidgetResizable(true);
	scrollArea->setMinimumWidth(450);
	splitter->addWidget(scrollArea);
	splitter->setStretchFactor(0, 1);

	QFrame *topWidget = new QFrame(scrollArea);
	scrollArea->setWidget(topWidget);

	QGridLayout *topLayout = new QGridLayout(topWidget); // Needed to justify at top
	topWidget->setLayout(topLayout);

	//------------------------- Parameters --------------------------

	int row = 0;

	QLabel *edgesLengthLabel = new QLabel(tr("Mesh Edges Length:"));
	topLayout->addWidget(edgesLengthLabel, row, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_edgesLength = new DVGui::MeasuredDoubleField;
	m_edgesLength->setMeasure("length.x");
	m_edgesLength->setRange(0.0, 1.0); // In inches (standard unit)
	m_edgesLength->setValue(0.2);

	topLayout->addWidget(m_edgesLength, row++, 1);

	QLabel *rasterizationDpiLabel = new QLabel(tr("Rasterization DPI:"));
	topLayout->addWidget(rasterizationDpiLabel, row, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_rasterizationDpi = new DVGui::DoubleLineEdit;
	m_rasterizationDpi->setRange(1.0, (std::numeric_limits<double>::max)());
	m_rasterizationDpi->setValue(300.0);

	topLayout->addWidget(m_rasterizationDpi, row++, 1);

	QLabel *shapeMarginLabel = new QLabel(tr("Mesh Margin (pixels):"));
	topLayout->addWidget(shapeMarginLabel, row, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_margin = new DVGui::IntLineEdit;
	m_margin->setRange(2, (std::numeric_limits<int>::max)());
	m_margin->setValue(5);

	topLayout->addWidget(m_margin, row++, 1);

	connect(m_edgesLength, SIGNAL(valueChanged(bool)), this, SLOT(onParamsChanged(bool)));
	connect(m_rasterizationDpi, SIGNAL(editingFinished()), this, SLOT(onParamsChanged()));
	connect(m_margin, SIGNAL(editingFinished()), this, SLOT(onParamsChanged()));

	topLayout->setRowStretch(row, 1);

	//------------------------- View Widget -------------------------

	// NOTE: It's IMPORTANT that parent widget is supplied. It's somewhat
	// used by QSplitter to decide the initial widget sizes...

	m_viewer = new Swatch(splitter);
	m_viewer->setMinimumHeight(150);
	m_viewer->setFocusPolicy(Qt::WheelFocus);

	splitter->addWidget(m_viewer);

	//--------------------------- Buttons ---------------------------

	m_okBtn = new QPushButton(tr("Apply"));
	addButtonBarWidget(m_okBtn);

	connect(m_okBtn, SIGNAL(clicked()), this, SLOT(apply()));

	// Finally, acquire current selection
	onCellSwitched();

	m_viewer->resize(0, 350);
	resize(600, 700);
}
Beispiel #8
0
void mafMainWindow::initializeMainWindow() {
    ui->setupUi(this);

    mafGUIRegistration::registerGUIObjects();
    m_GUIManager = new mafGUIManager(this, mafCodeLocation);

    m_GUIManager->createMenus();
    m_GUIManager->createToolBars();

    connectCallbacks();

    ui->statusBar->showMessage(mafTr("Ready!"));

    // Connecting layouts (needed because from QtDesign is not managed automatically)
    ui->centralWidget->setLayout(ui->gridLayout);
	// SideBar Layout
    ui->sideBarDockContents->setLayout(ui->layoutSideBar);
    // View's tab
    ui->tabView->setLayout(ui->layoutView);
    // Operation's tab
    ui->tabOperation->setLayout(ui->layoutOperation);
    // Hierarchy tree's tab
    ui->tabTree->setLayout(ui->layoutTree);
    ui->hierarchyWidget->setLayout(ui->layoutHierarchy);
    ui->propertiesBoxContainer->setLayout(ui->layoutPropertiesBox);

    //tree widget in sidebar
    m_Model = new mafTreeModel();

    if(m_Logic) {
        m_Model->setHierarchy(m_Logic->hierarchy());
     }

    // **** SideBar ****
    m_Tree = m_GUIManager->createTreeWidget(m_Model, ui->hierarchyWidget);

    QSplitter *splitter = new QSplitter(Qt::Vertical);
    splitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    splitter->addWidget(ui->hierarchyWidget);
    splitter->addWidget(ui->propertiesBoxContainer);
    ui->layoutTree->addWidget(splitter);
    splitter->setStretchFactor(1, 1);

    // SideBar visibility management
    QObject *sideBarAction = m_GUIManager->actionByName("SideBar");
    connect(ui->dockSideBar, SIGNAL(visibilityChanged(bool)), sideBarAction, SLOT(setChecked(bool)));
    connect(sideBarAction, SIGNAL(triggered(bool)), ui->dockSideBar, SLOT(setVisible(bool)));

    // **** LogBar ****
    // LogBar Layout
    ui->logBarWidgetContents->setLayout(ui->gridLayoutLogBar);

    QObject *logBarAction = m_GUIManager->actionByName("LogBar");
    m_LogWidget = m_GUIManager->createLogWidget(ui->logBarWidgetContents);
    connect(ui->dockLogBarWidget, SIGNAL(visibilityChanged(bool)), logBarAction, SLOT(setChecked(bool)));
    connect(logBarAction, SIGNAL(triggered(bool)), ui->dockLogBarWidget, SLOT(setVisible(bool)));

    // **** Google chat ****
    QObject *collaborateAction = m_GUIManager->actionByName("Collaborate");
    m_DockGoogleChat = new QDockWidget(tr("Google Chat"));
    m_DockGoogleChat->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    m_DockGoogleChat->setWidget(new GoogleChat());
    if(collaborateAction) {
        connect(collaborateAction, SIGNAL(triggered(bool)), this, SLOT(updateCollaborationDockVisibility(bool)));
        connect(m_DockGoogleChat, SIGNAL(visibilityChanged(bool)), collaborateAction, SLOT(setChecked(bool)));
    }

    connect(ui->mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, SLOT(subWindowSelected(QMdiSubWindow*)));

    setUnifiedTitleAndToolBarOnMac(true);

    // Restore settings notification should be sent at the end of the initialization code, so to be sure that
    // each GUI element has been created.
    mafEventBus::mafEventBusManager::instance()->notifyEvent("maf.local.logic.settings.restore");
}
BinarizePopup::BinarizePopup()
	: Dialog(TApp::instance()->getMainWindow(), true, false, "Binarize"), m_frameIndex(-1), m_progressBar(0), m_timerId(0)
{
	setWindowTitle(tr("Binarize"));
	setLabelWidth(0);
	setModal(false);

	setTopMargin(0);
	setTopSpacing(0);

	beginVLayout();

	QSplitter *splitter = new QSplitter(Qt::Vertical);
	splitter->setSizePolicy(
		QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
	addWidget(splitter);

	endVLayout();

	QWidget *parametersArea = new QFrame();
	splitter->addWidget(parametersArea);

	QGridLayout *parametersLayout = new QGridLayout();

	// parametersArea->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed));

	//QFrame* topWidget = new QFrame(scrollArea);
	//topWidget->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed));
	//scrollArea->setWidget(topWidget);

	// parametersLayout->setSizeConstraint(QLayout::SetFixedSize);

	//------------------------- Parameters --------------------------

	/*
  //Brightness
	QLabel* brightnessLabel = new QLabel(tr("Brightness:"));
	topLayout->addWidget(brightnessLabel, 0, 0, Qt::AlignRight | Qt::AlignVCenter);

  m_brightnessField = new DVGui::IntField(topWidget);
  m_brightnessField->setRange(-127, 127);
  m_brightnessField->setValue(0);
	topLayout->addWidget(m_brightnessField, 0, 1);

  //Contrast
	QLabel* contrastLabel = new QLabel(tr("Contrast:"));
	topLayout->addWidget(contrastLabel, 1, 0, Qt::AlignRight | Qt::AlignVCenter);

  m_contrastField = new DVGui::IntField(topWidget);
  m_contrastField->setRange(-127, 127);
  m_contrastField->setValue(0);
	topLayout->addWidget(m_contrastField, 1, 1);
*/

	m_alphaChk = new DVGui::CheckBox(tr("Alpha"));
	m_previewChk = new DVGui::CheckBox(tr("Preview"));
	parametersLayout->addWidget(m_alphaChk, 0, 0);
	parametersLayout->addWidget(m_previewChk, 0, 1);

	parametersArea->setLayout(parametersLayout);

	//--------------------------- Swatch ----------------------------

	m_viewer = new Swatch();
	m_viewer->setMinimumHeight(150);
	m_viewer->setFocusPolicy(Qt::WheelFocus);
	splitter->addWidget(m_viewer);

	splitter->setStretchFactor(0, 0);
	splitter->setStretchFactor(1, 1);

	//--------------------------- Button ----------------------------

	m_okBtn = new QPushButton(tr("Apply"), this);
	connect(m_okBtn, SIGNAL(clicked()), this, SLOT(apply()));

	addButtonBarWidget(m_okBtn);

	//------------------------ Connections --------------------------

	bool ret = true;

	//ret = ret && connect(m_brightnessField, SIGNAL(valueChanged(bool)), this, SLOT(onValuesChanged(bool)));
	//ret = ret && connect(m_contrastField,   SIGNAL(valueChanged(bool)), this, SLOT(onValuesChanged(bool)));
	ret = ret && connect(m_previewChk, SIGNAL(stateChanged(int)), this, SLOT(onPreviewCheckboxChanged(int)));

	ret = ret && connect(m_alphaChk, SIGNAL(stateChanged(int)), this, SLOT(onAlphaCheckboxChanged(int)));

	assert(ret);

	m_viewer->resize(0, 350);
	resize(600, 500);
}
AdjustLevelsPopup::AdjustLevelsPopup()
	: DVGui::Dialog(TApp::instance()->getMainWindow(), true, false, "AdjustLevels"), m_thresholdD(0.005) //0.5% of the image size
{
	int i, j;

	setWindowTitle(tr("Adjust Levels"));
	setLabelWidth(0);
	setModal(false);

	setTopMargin(0);
	setTopSpacing(0);

	beginVLayout();

	QSplitter *splitter = new QSplitter(Qt::Vertical);
	splitter->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
	addWidget(splitter);

	endVLayout();

	//------------------------- Top Layout --------------------------

	QScrollArea *scrollArea = new QScrollArea(splitter);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	scrollArea->setWidgetResizable(true);
	scrollArea->setMinimumWidth(450);
	splitter->addWidget(scrollArea);
	splitter->setStretchFactor(0, 1);

	QFrame *topWidget = new QFrame(scrollArea);
	scrollArea->setWidget(topWidget);

	QVBoxLayout *topVLayout = new QVBoxLayout(topWidget); //Needed to justify at top
	topWidget->setLayout(topVLayout);

	QHBoxLayout *topLayout = new QHBoxLayout(topWidget);
	topVLayout->addLayout(topLayout);
	topVLayout->addStretch(1);

	//------------------------- Histogram ---------------------------

	m_histogram = new Histogram(topWidget);
	topLayout->addWidget(m_histogram);

	//------------------------- Mark Bars ---------------------------

	MarksBar *histogramMarksBar, *colorBarMarksBar;
	QVBoxLayout *histogramViewLayout;

	for (i = 0; i < 5; ++i) {
		HistogramView *view = m_histogram->getHistograms()->getHistogramView(i);
		histogramViewLayout = static_cast<QVBoxLayout *>(view->layout());

		//Don't draw channel numbers
		view->channelBar()->setDrawNumbers(false);

		for (j = 0; j < 2; ++j) {
			EditableMarksBar *editableMarksBar = m_marksBar[j + (i << 1)] = new EditableMarksBar;
			MarksBar *marksBar = editableMarksBar->marksBar();

			//Set margins up to cover the histogram
			editableMarksBar->layout()->setContentsMargins(6, 0, 5, 0);
			connect(editableMarksBar, SIGNAL(paramsChanged()), this, SLOT(onParamsChanged()));

			histogramViewLayout->insertWidget(1 + (j << 1), editableMarksBar);
		}
	}

	//------------------------- View Widget -------------------------

	//NOTE: It's IMPORTANT that parent widget is supplied. It's somewhat
	//used by QSplitter to decide the initial widget sizes...

	m_viewer = new Swatch(splitter);
	m_viewer->setMinimumHeight(150);
	m_viewer->setFocusPolicy(Qt::WheelFocus);
	splitter->addWidget(m_viewer);

	//--------------------------- Buttons ---------------------------

	QVBoxLayout *buttonsLayout = new QVBoxLayout(topWidget);
	topLayout->addLayout(buttonsLayout);

	buttonsLayout->addSpacing(50);

	QPushButton *clampRange = new QPushButton(tr("Clamp"), topWidget);
	clampRange->setMinimumSize(65, 25);
	buttonsLayout->addWidget(clampRange);
	connect(clampRange, SIGNAL(clicked(bool)), this, SLOT(clampRange()));

	QPushButton *autoAdjust = new QPushButton(tr("Auto"), topWidget);
	autoAdjust->setMinimumSize(65, 25);
	buttonsLayout->addWidget(autoAdjust);
	connect(autoAdjust, SIGNAL(clicked(bool)), this, SLOT(autoAdjust()));

	QPushButton *resetBtn = new QPushButton(tr("Reset"), topWidget);
	resetBtn->setMinimumSize(65, 25);
	buttonsLayout->addWidget(resetBtn);
	connect(resetBtn, SIGNAL(clicked(bool)), this, SLOT(reset()));

	buttonsLayout->addStretch(1);

	m_okBtn = new QPushButton(tr("Apply"));
	addButtonBarWidget(m_okBtn);

	connect(m_okBtn, SIGNAL(clicked()), this, SLOT(apply()));

	//Finally, acquire current selection
	acquireRaster();

	m_viewer->resize(0, 350);
	resize(600, 700);
}
Beispiel #11
0
/**
 * Constructor.
 */
InstrumentWindow::InstrumentWindow(const QString &wsName, const QString &label,
                                   ApplicationWindow *app, const QString &name,
                                   Qt::WFlags f)
    : MdiSubWindow(app, label, name, f), WorkspaceObserver(),
      m_InstrumentDisplay(NULL), m_simpleDisplay(NULL), m_workspaceName(wsName),
      m_instrumentActor(NULL), m_surfaceType(FULL3D),
      m_savedialog_dir(QString::fromStdString(
                           Mantid::Kernel::ConfigService::Instance().getString(
                               "defaultsave.directory"))),
      mViewChanged(false), m_blocked(false),
      m_instrumentDisplayContextMenuOn(false) {
    setFocusPolicy(Qt::StrongFocus);
    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    QSplitter *controlPanelLayout = new QSplitter(Qt::Horizontal);

    // Add Tab control panel
    mControlsTab = new QTabWidget(this, 0);
    controlPanelLayout->addWidget(mControlsTab);
    controlPanelLayout->setSizePolicy(QSizePolicy::Expanding,
                                      QSizePolicy::Expanding);

    // Create the display widget
    m_InstrumentDisplay = new MantidGLWidget(this);
    m_InstrumentDisplay->installEventFilter(this);
    connect(this, SIGNAL(enableLighting(bool)), m_InstrumentDisplay,
            SLOT(enableLighting(bool)));

    // Create simple display widget
    m_simpleDisplay = new SimpleWidget(this);
    m_simpleDisplay->installEventFilter(this);

    QWidget *aWidget = new QWidget(this);
    m_instrumentDisplayLayout = new QStackedLayout(aWidget);
    m_instrumentDisplayLayout->addWidget(m_InstrumentDisplay);
    m_instrumentDisplayLayout->addWidget(m_simpleDisplay);

    controlPanelLayout->addWidget(aWidget);

    mainLayout->addWidget(controlPanelLayout);

    m_xIntegration = new XIntegrationControl(this);
    mainLayout->addWidget(m_xIntegration);
    connect(m_xIntegration, SIGNAL(changed(double, double)), this,
            SLOT(setIntegrationRange(double, double)));

    // Set the mouse/keyboard operation info and help button
    QHBoxLayout *infoLayout = new QHBoxLayout();
    mInteractionInfo = new QLabel();
    infoLayout->addWidget(mInteractionInfo);
    QPushButton *helpButton = new QPushButton("?");
    helpButton->setMaximumWidth(25);
    connect(helpButton, SIGNAL(clicked()), this, SLOT(helpClicked()));
    infoLayout->addWidget(helpButton);
    infoLayout->setStretchFactor(mInteractionInfo, 1);
    infoLayout->setStretchFactor(helpButton, 0);
    mainLayout->addLayout(infoLayout);

    QSettings settings;
    settings.beginGroup("Mantid/InstrumentWindow");

    // Background colour
    setBackgroundColor(
        settings.value("BackgroundColor", QColor(0, 0, 0, 1.0)).value<QColor>());

    // Create the b=tabs
    createTabs(settings);

    settings.endGroup();

    // Init actions
    m_clearPeakOverlays = new QAction("Clear peaks", this);
    connect(m_clearPeakOverlays, SIGNAL(activated()), this,
            SLOT(clearPeakOverlays()));

    confirmClose(app->confirmCloseInstrWindow);

    setAttribute(Qt::WA_DeleteOnClose);

    // Watch for the deletion of the associated workspace
    observePreDelete();
    observeAfterReplace();
    observeRename();
    observeADSClear();

    connect(app->mantidUI->getAlgMonitor(), SIGNAL(algorithmStarted(void *)),
            this, SLOT(block()));
    connect(app->mantidUI->getAlgMonitor(), SIGNAL(allAlgorithmsStopped()), this,
            SLOT(unblock()));

    const int windowWidth = 800;
    const int tabsSize = windowWidth / 4;
    QList<int> sizes;
    sizes << tabsSize << windowWidth - tabsSize;
    controlPanelLayout->setSizes(sizes);
    controlPanelLayout->setStretchFactor(0, 0);
    controlPanelLayout->setStretchFactor(1, 1);

    resize(windowWidth, 650);

    tabChanged(0);

    connect(this, SIGNAL(needSetIntegrationRange(double, double)), this,
            SLOT(setIntegrationRange(double, double)), Qt::QueuedConnection);
    setAcceptDrops(true);

    setWindowTitle(QString("Instrument - ") + m_workspaceName);
}
Beispiel #12
0
SyntaxEditorWindow::SyntaxEditorWindow(const QSharedPointer<SyntaxList> &syntaxList, const QString &syntaxName,
		const QString &category, const QString &syntaxHint, QWidget *parent) :
		QWidget(parent), syntaxList(syntaxList), syntaxName(syntaxName)
{
	setWindowRole("kadu-syntax-editor");

	setWindowTitle(tr("Kadu syntax editor"));
	setAttribute(Qt::WA_DeleteOnClose);

	QVBoxLayout *layout = new QVBoxLayout(this);

	QSplitter *splitter = new QSplitter(this);
	layout->addWidget(splitter);
	splitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	splitter->setChildrenCollapsible(false);

	QWidget *splitterleft = new QWidget(splitter);
	QVBoxLayout *splitterleftlayout = new QVBoxLayout(splitterleft);
	splitterleftlayout->setMargin(0);
	splitterleftlayout->setSpacing(5);

	editor = new QTextEdit(this);
	splitterleftlayout->addWidget(editor);
	editor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	editor->setAcceptRichText(true);
	editor->setPlainText(syntaxList->readSyntax(syntaxName));
	QFont font = this->font();
	font.setFamily("monospace");
	if(font.pixelSize() == -1)
		font.setPointSizeF(font.pointSizeF() - 0.5);
	else
		font.setPixelSize(font.pixelSize() - 2);
	editor->setFont(font);
	editor->setMinimumSize(EDITOR_MINIMUM_SIZE);

	if (!syntaxHint.isEmpty())
	{
		QLabel *editorhint = new QLabel(this);
		splitterleftlayout->addWidget(editorhint);
		editorhint->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
		editorhint->setWordWrap(true);
		editorhint->setText(syntaxHint);
	}

	QWidget *splitterright = new QWidget(splitter);
	QVBoxLayout *splitterrightlayout = new QVBoxLayout(splitterright);
	splitterrightlayout->setMargin(0);
	splitterrightlayout->setSpacing(5);

	previewPanel = new Preview(this);
	splitterrightlayout->addWidget(previewPanel);
	previewPanel->setMinimumHeight(0);
	previewPanel->setMaximumHeight(QWIDGETSIZE_MAX);
	previewPanel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
	previewPanel->setResetBackgroundColor(config_file.readEntry("Look", category + "BgColor"));
	previewPanel->setMinimumSize(PREVIEW_MINIMUM_SIZE);

	QPushButton *previewbutton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_BrowserReload), tr("Refresh Preview"), this);
	splitterrightlayout->addWidget(previewbutton);
	connect(previewbutton, SIGNAL(clicked()), this, SLOT(refreshPreview()));

	QDialogButtonBox *buttonslayout = new QDialogButtonBox(Qt::Horizontal, this);
	layout->addWidget(buttonslayout);
	QPushButton *saveSyntax = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogOkButton), tr("Save"), this);
	QPushButton *saveAsSyntax = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogSaveButton), tr("Save as..."), this);
	QPushButton *cancel = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton), tr("Cancel"), this);
	buttonslayout->addButton(saveSyntax, QDialogButtonBox::YesRole);
	buttonslayout->addButton(saveAsSyntax, QDialogButtonBox::ActionRole);
	buttonslayout->addButton(cancel, QDialogButtonBox::RejectRole);

	splitter->setSizes( QList<int>() << splitter->sizeHint().width() << 1 );

	if (syntaxList->isGlobal(syntaxName))
		saveSyntax->setDisabled(true);
	else
		connect(saveSyntax, SIGNAL(clicked()), this, SLOT(save()));
	connect(saveAsSyntax, SIGNAL(clicked()), this, SLOT(saveAs()));
	connect(cancel, SIGNAL(clicked()), this, SLOT(close()));

	loadWindowGeometry(this, "Look", "SyntaxEditorGeometry", 0, 50, 790, 480);
}
LinesFadePopup::LinesFadePopup()
	: Dialog(TApp::instance()->getMainWindow(), true, false, "LinesFade"), m_startRas(0)
{
	setWindowTitle(tr("Color Fade"));
	setLabelWidth(0);
	setModal(false);

	setTopMargin(0);
	setTopSpacing(0);

	beginVLayout();

	QSplitter *splitter = new QSplitter(Qt::Vertical);
	splitter->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
	addWidget(splitter);

	endVLayout();

	//------------------------- Top Layout --------------------------

	QScrollArea *scrollArea = new QScrollArea(splitter);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	scrollArea->setWidgetResizable(true);
	splitter->addWidget(scrollArea);
	splitter->setStretchFactor(0, 1);

	QFrame *topWidget = new QFrame(scrollArea);
	topWidget->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
	scrollArea->setWidget(topWidget);

	QGridLayout *topLayout = new QGridLayout(this);
	topWidget->setLayout(topLayout);

	//------------------------- Parameters --------------------------

	//Fade
	QLabel *fadeLabel = new QLabel(tr("Fade:"));
	topLayout->addWidget(fadeLabel, 0, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_linesColorField = new DVGui::ColorField(this, true, TPixel32::Black, 40);
	m_linesColorField->setFixedHeight(40);

	topLayout->addWidget(m_linesColorField, 0, 1);

	//Intensity
	QLabel *intensityLabel = new QLabel(tr("Intensity:"));
	topLayout->addWidget(intensityLabel, 1, 0, Qt::AlignRight | Qt::AlignVCenter);

	m_intensity = new IntField(this);
	m_intensity->setValues(100, 0, 100);
	topLayout->addWidget(m_intensity, 1, 1);

	topLayout->setRowStretch(2, 1);

	//--------------------------- Swatch ----------------------------

	m_viewer = new Swatch(splitter);
	m_viewer->setMinimumHeight(150);
	m_viewer->setFocusPolicy(Qt::WheelFocus);
	splitter->addWidget(m_viewer);

	//--------------------------- Button ----------------------------

	m_okBtn = new QPushButton(QString("Apply"), this);
	connect(m_okBtn, SIGNAL(clicked()), this, SLOT(apply()));

	addButtonBarWidget(m_okBtn);

	//------------------------ Connections --------------------------

	TApp *app = TApp::instance();

	bool ret = true;

	ret = ret && connect(m_linesColorField, SIGNAL(colorChanged(const TPixel32 &, bool)),
						 this, SLOT(onLinesColorChanged(const TPixel32 &, bool)));
	ret = ret && connect(m_intensity, SIGNAL(valueChanged(bool)), this, SLOT(onIntensityChanged(bool)));

	assert(ret);

	m_viewer->resize(0, 350);
	resize(600, 500);
}
scannerwindow::scannerwindow(QList<int> parameters, QMainWindow *parent, bool load, QTextStream* stream):
    QObject(parent)
{
    this->parameters=parameters;
    widget = new QWidget();
    widget->setAttribute(Qt::WA_DeleteOnClose);
    graph = new Q3DSurface();
    container = QWidget::createWindowContainer(graph, widget);
    container->setAttribute(Qt::WA_AcceptTouchEvents);

    widget->setGeometry(
        QStyle::alignedRect(
            Qt::LeftToRight,
            Qt::AlignTop,
            widget->size(),
            qApp->desktop()->availableGeometry()
        )
    );

    bitmapForward=new QCustomPlot(widget);
    bitmapBackward=new QCustomPlot(widget);
    bitmapCombined=new QCustomPlot(widget);

    bitmapForward->setContextMenuPolicy(Qt::CustomContextMenu);
    bitmapBackward->setContextMenuPolicy(Qt::CustomContextMenu);
    bitmapCombined->setContextMenuPolicy(Qt::CustomContextMenu);



    bitmapBackward->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    bitmapForward->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    bitmapCombined->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    initializeBitmapForward(bitmapForward);
    initializeBitmapBackward(bitmapBackward);
    initializeBitmapCombined(bitmapCombined);

    if (!graph->hasContext()) {
        QMessageBox msgBox;
        msgBox.setText("Couldn't initialize the OpenGL context.");
        msgBox.exec();
    }

    QSize screenSize = graph->screen()->size();
    container->setMinimumSize(QSize(screenSize.width() / 3, screenSize.height()/4));
    container->setMaximumSize(screenSize);
    container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    container->setFocusPolicy(Qt::StrongFocus);

    bitmapBackward->setMinimumSize(screenSize.width()/4, screenSize.height()/4);
    bitmapForward->setMinimumSize(screenSize.width()/4, screenSize.height()/4);
    bitmapCombined->setMinimumSize(screenSize.width()/4, screenSize.height()/4);


    QHBoxLayout *hLayout = new QHBoxLayout(widget);
    QVBoxLayout *vLayout = new QVBoxLayout();
    QSplitter *hSplitterMain = new QSplitter();
    QSplitter *vSplitterRight = new QSplitter();

    hLayout->setSizeConstraint(QBoxLayout::SizeConstraint::SetMinimumSize);

    vSplitterRight->addWidget(bitmapForward);
    vSplitterRight->addWidget(bitmapBackward);
    vSplitterRight->addWidget(bitmapCombined);

    vSplitterRight->setOrientation(Qt::Orientation::Vertical);
    vSplitterRight->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
    hSplitterMain->setOrientation(Qt::Orientation::Horizontal);

    hSplitterMain->addWidget(container);
    hSplitterMain->addWidget(vSplitterRight);

    hSplitterMain->setStyleSheet("QSplitter::handle {background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,stop:0 rgba(255, 255, 255, 0),stop:0.407273 rgba(200, 200, 200, 255),stop:0.4825 rgba(101, 104, 113, 235), stop:0.6 rgba(255, 255, 255, 0));}");
    vSplitterRight->setStyleSheet("QSplitter::handle {background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,stop:0 rgba(255, 255, 255, 0),stop:0.407273 rgba(200, 200, 200, 255),stop:0.4825 rgba(101, 104, 113, 235), stop:0.6 rgba(255, 255, 255, 0));}");

    hLayout->addWidget(hSplitterMain);
    hLayout->addLayout(vLayout);
    vLayout->setAlignment(Qt::AlignTop);

    widget->setWindowTitle(QStringLiteral("AFM Scan"));
    QGroupBox *modelGroupBox = new QGroupBox(QStringLiteral("Scan"));



if(!load){
    AFM_Scan_3D_RB = new QPushButton(widget);
    AFM_Scan_3D_RB->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
    AFM_Scan_3D_RB->setText(QStringLiteral("Start Scan"));
    AFM_Scan_3D_RB->setCheckable(true);
    AFM_Scan_3D_RB->setChecked(false);



}
    SaveSurface = new QPushButton(widget);
    SaveSurface->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
    SaveSurface->setText(QStringLiteral("Save Data"));

    BitmapView = new QPushButton(widget);
    BitmapView->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
    BitmapView->setText(QStringLiteral("Save BMP"));

    QVBoxLayout *modelVBox = new QVBoxLayout;

   if(!load){
       modelVBox->addWidget(AFM_Scan_3D_RB);


   }
    modelVBox->addWidget(BitmapView);
    modelVBox->addWidget(SaveSurface);
    modelGroupBox->setLayout(modelVBox);

    QGroupBox *selectionGroupBox = new QGroupBox(QStringLiteral("Selection Mode"));
    selectionGroupBox->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));

    QCheckBox *piezoMove = new QCheckBox(widget);
    piezoMove->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
    piezoMove->setText(QStringLiteral("Piezo"));
    piezoMove->setChecked(true);
    modelVBox->addWidget(piezoMove);

    QRadioButton *modeNoneRB = new QRadioButton(widget);
    modeNoneRB->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
    modeNoneRB->setText(QStringLiteral("No selection"));
    modeNoneRB->setChecked(false);

    QRadioButton *modeItemRB = new QRadioButton(widget);
    modeItemRB->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
    modeItemRB->setText(QStringLiteral("Item"));
    modeItemRB->setChecked(false);

    QRadioButton *modeSliceRowRB = new QRadioButton(widget);
    modeSliceRowRB->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
    modeSliceRowRB->setText(QStringLiteral("Row Slice"));
    modeSliceRowRB->setChecked(false);

    QRadioButton *modeSliceColumnRB = new QRadioButton(widget);
    modeSliceColumnRB->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
    modeSliceColumnRB->setText(QStringLiteral("Column Slice"));
    modeSliceColumnRB->setChecked(false);

    QVBoxLayout *selectionVBox = new QVBoxLayout;
    selectionVBox->addWidget(modeNoneRB);
    selectionVBox->addWidget(modeItemRB);
    selectionVBox->addWidget(modeSliceRowRB);
    selectionVBox->addWidget(modeSliceColumnRB);
    selectionGroupBox->setLayout(selectionVBox);

    QSlider *axisCameraSliderZ = new QSlider(Qt::Horizontal, widget);
    axisCameraSliderZ->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
    axisCameraSliderZ->setMinimum(0);
    axisCameraSliderZ->setMaximum(179);
    axisCameraSliderZ->setTickInterval(1);
    axisCameraSliderZ->setEnabled(true);

    QSlider *axisCameraSliderY = new QSlider(Qt::Horizontal, widget);
    axisCameraSliderY->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
    axisCameraSliderY->setMinimum(0);
    axisCameraSliderY->setMaximum(180);
    axisCameraSliderY->setTickInterval(0);
    axisCameraSliderY->setEnabled(true);


    QComboBox *themeList = new QComboBox(widget);
    themeList->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));

    themeList->addItem(QStringLiteral("Qt"));
    themeList->addItem(QStringLiteral("Primary Colors"));
    themeList->addItem(QStringLiteral("Digia"));
    themeList->addItem(QStringLiteral("Stone Moss"));    
    themeList->addItem(QStringLiteral("Army Blue"));
    themeList->addItem(QStringLiteral("Retro"));
    themeList->addItem(QStringLiteral("Ebony"));
    themeList->addItem(QStringLiteral("Isabelle"));

    QGroupBox *colorGroupBox = new QGroupBox(QStringLiteral("Custom gradient"));

    QLinearGradient grBtoY(0, 0, 1, 100);
    grBtoY.setColorAt(1.0, Qt::black);
    grBtoY.setColorAt(0.67, Qt::blue);
    grBtoY.setColorAt(0.33, Qt::red);
    grBtoY.setColorAt(0.0, Qt::yellow);

    QPixmap pm(24, 100);
    QPainter pmp(&pm);
    pmp.setBrush(QBrush(grBtoY));
    pmp.setPen(Qt::NoPen);
    pmp.drawRect(0, 0, 24, 100);

    QPushButton *gradientBtoYPB = new QPushButton(widget);
    gradientBtoYPB->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
    gradientBtoYPB->setIcon(QIcon(pm));
    gradientBtoYPB->setIconSize(QSize(24, 100));

    QLinearGradient grGtoR(0, 0, 1, 100);
    grGtoR.setColorAt(1.0, Qt::darkGreen);
    grGtoR.setColorAt(0.5, Qt::yellow);
    grGtoR.setColorAt(0.2, Qt::red);
    grGtoR.setColorAt(0.0, Qt::darkRed);
    pmp.setBrush(QBrush(grGtoR));
    pmp.drawRect(0, 0, 24, 100);

    QPushButton *gradientGtoRPB = new QPushButton(widget);
    gradientGtoRPB->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
    gradientGtoRPB->setIcon(QIcon(pm));
    gradientGtoRPB->setIconSize(QSize(24, 100));

    QHBoxLayout *colorHBox = new QHBoxLayout;
    colorHBox->addWidget(gradientBtoYPB);
    colorHBox->addWidget(gradientGtoRPB);
    colorGroupBox->setLayout(colorHBox);

    vLayout->addWidget(modelGroupBox);
    vLayout->addWidget(selectionGroupBox);

    vLayout->addWidget(new QLabel(QStringLiteral("Camera Position")));
    vLayout->addWidget(axisCameraSliderZ);
    vLayout->addWidget(axisCameraSliderY);
    vLayout->addWidget(new QLabel(QStringLiteral("Theme")));
    vLayout->addWidget(themeList);
    vLayout->addWidget(colorGroupBox);

    widget->show();
    modifier= new SurfaceGraph(graph, widget,parameters);

if(!load){

    QObject::connect(parent, SIGNAL(plotDataReceived(QList <QByteArray>)),
                     modifier, SLOT(dataHandler(QList <QByteArray>)));

    QObject::connect(AFM_Scan_3D_RB, SIGNAL (toggled(bool)),
                     this, SLOT(AFMButtonHandler(bool)));

    QObject::connect(this, SIGNAL (AFMStart()),
                     modifier, SLOT (enableAFMModel()));

    QObject::connect(this, SIGNAL (AFMDone()),
                     parent, SLOT (sendDone()));

    QObject::connect(this, SIGNAL (AFMStart()),
                     parent, SLOT (sendGo()));

    QObject::connect(this, SIGNAL (AFMStart()),
                     parent, SLOT(sendReady()));}
Beispiel #15
0
//****************************************************************************
MainWindow::MainWindow (QWidget* parent, Qt::WFlags fl)
{
	
	
	// Setup the QRAP error handling system
	QRAP_SET_ALERT_CALLBACK((AlertCallback)(Qrap::MainWindowAlert));
	
	CreateActions();
	CreateMenus();
	CreateToolBars();
	CreateStatusBar();
	ReadSettings();
	
	// Create the clipboard
	clipboard = QApplication::clipboard();
	
	// Set the window title
	setWindowTitle("Q-Rap Database Interface");
	setWindowIcon(QIcon(":images/logo_icon.png"));
	
	// Check if there are any system preferences
	if(gDb.GetSetting("location")=="")
	{
//		gDb.SetSetting("location","DD.dddd");
		gDb.SetSetting("sensitivity","dBm");
		gDb.SetSetting("power","dBm");
		gDb.SetSetting("eirp","dBm");
		gDb.SetSetting("impedence","50");
		gDb.SetSetting("predictioneirp","explicit");
		gDb.SetSetting("location","DD:MM:SS");
		gDb.SetSetting("mode","normal");
		gDb.SetSetting("DisplayUnits","dBm");
		gDb.SetSetting("TechType","0:NULL");
		gDb.SetSetting("RqSN","8.00");
		gDb.SetSetting("FadeMargin","3.00");
		gDb.SetSetting("RxMin","-110.00");
		gDb.SetSetting("RqCiCo","9.00");
		gDb.SetSetting("RqCiad","-9.00");
		gDb.SetSetting("RqEbNo","8.00");
		gDb.SetSetting("kFactorServer","1.00");
		gDb.SetSetting("kFactorInt","2.5");
		gDb.SetSetting("UseClutter","false");
		gDb.SetSetting("BTLDir","/home/");
		gDb.SetSetting("OutputDir","/home");
		gDb.SetSetting("SiteSelectSense","150.00");
		gDb.SetSetting("PlotResolution","90.00");
		gDb.SetSetting("DownLink","true");
	} // if GetSetting(location)
	
//	QWidget* gridLayout_1 = new QWidget(this);
//	gridLayout_1->setObjectName(QString::fromUtf8("gridLayout_1"));
	//gridLayout_1->setGeometry(QRect(0,70,790,180));
//	setCentralWidget(gridLayout_1);
//	QGridLayout* gridLayout1 = new QGridLayout(gridLayout_1);
//	gridLayout1->setSpacing(6);
//	gridLayout1->setMargin(0);
//	gridLayout1->setObjectName(QString::fromUtf8("gridLayout1"));

	QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    	sizePolicy.setHorizontalStretch(200);
    	sizePolicy.setVerticalStretch(200);

    	QSplitter*  splitter;
	splitter = new QSplitter(this);
    	splitter->setObjectName(QString::fromUtf8("splitter"));
    	splitter->setOrientation(Qt::Horizontal);
	splitter->setOpaqueResize(true);
	splitter->setSizePolicy(sizePolicy);
    	sizePolicy.setHeightForWidth(splitter->sizePolicy().hasHeightForWidth());
	setCentralWidget(splitter);

	rapTab = new RapTab(splitter);
	rapTab->setGeometry(QRect(10,10,1550,450));
	rapTab->setMinimumSize(QSize(100, 100));
	rapTab->setSizePolicy(sizePolicy);
    	splitter->addWidget(rapTab);	

	Filter = new cFilter(splitter);
	Filter->setGeometry(QRect(10,10,350,450));
	Filter->setMinimumSize(QSize(100, 100));
	Filter->setSizePolicy(sizePolicy);
	splitter->addWidget(Filter);

	setMaximumHeight(700);
	showMaximized ();
	

//	QSpacerItem *spacerItem1 = new QSpacerItem(1, 90, QSizePolicy::Minimum, QSizePolicy::Minimum);
//    gridLayout1->addItem(spacerItem1, 0, 1, 1, 1);
	
	
//	QSpacerItem *spacerItem = new QSpacerItem(1, 400, QSizePolicy::Minimum, QSizePolicy::Maximum);
//    gridLayout1->addItem(spacerItem, 1, 1, 1, 1);
		
	// Create the main widget
//	CreateDockingTab(Body);
	
	
}
Beispiel #16
-1
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>")));
}