void GradientPreview::mouseReleaseEvent(QMouseEvent *m)
{
	if (isEditable)
	{
		QRect fpo;
		if (m->button() == Qt::LeftButton)
		{
			if ((Mpressed) && (ActStop > 0) && (ActStop != static_cast<int>(StopM.count()-1)) && (outside || m->y() > 60))
			{
				onlyselect = false;
				fill_gradient.removeStop(ActStop);
				ActStop = 0;
				repaint();
				QList<VColorStop*> cstops = fill_gradient.colorStops();
				emit selectedStop(cstops.at(ActStop));
			}
			if ((m->y() < height()) && (m->y() > 43) && (m->x() > 0) && (m->x() < width()) && (ActStop == -1))
			{
				QList<VColorStop*> cstops = fill_gradient.colorStops();
				double  newStop = static_cast<double>((m->x() - 10)) / (static_cast<double>(width())-20);
				QColor  stopColor = (cstops.count() > 0) ? cstops.at(0)->color : QColor(255, 255, 255);
				QString stopName  = (cstops.count() > 0) ? cstops.at(0)->name  : QString("White");
				int     stopShade = (cstops.count() > 0) ? cstops.at(0)->shade : 100;
				fill_gradient.addStop(stopColor, newStop, 0.5, 1.0, stopName, stopShade);
				repaint();
				onlyselect = false;
				cstops = fill_gradient.colorStops();
				for (int yg = 0; yg < static_cast<int>(StopM.count()); ++yg)
				{
					fpo = QRect(static_cast<int>(StopM[yg])-4, 43, 8, 13);
					if (fpo.contains(m->pos()))
					{
						ActStop = yg;
						emit selectedStop(cstops.at(ActStop));
						repaint();
						break;
					}
				}
			}
		}
		else if (m->button() == Qt::RightButton)
		{
			Mpressed = false;
			QList<VColorStop*> cstops = fill_gradient.colorStops();
			int stop = -1;
			for (int yg = 0; yg < static_cast<int>(StopM.count()); ++yg)
			{
				fpo = QRect(static_cast<int>(StopM[yg])-4, 43, 8, 13);
				if (fpo.contains(m->pos()))
				{
					stop = yg;
					break;
				}
			}
			contextStop = stop;
			mPos = m->pos();
			QMenu *pmen = new QMenu();
			qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
			pmen->addAction( tr("Add Stop"), this, SLOT(addStop()));
			if (stop != -1)
				pmen->addAction( tr("Remove Stop"), this, SLOT(removeStop()));
			pmen->exec(QCursor::pos());
			delete pmen;
		}
	}
	Mpressed = false;
	if (!onlyselect)
		emit gradientChanged();
}
Example #2
0
FloodFill::FloodFill(ToolController &owner)
	: Tool(owner, FLOODFILL, QCursor(QPixmap(":cursors/bucket.png"), 2, 29))
{
}
void QmitkAdaptiveRegionGrowingToolGUI::RunSegmentation()
{
  if (m_InputImageNode.IsNull())
  {
    QMessageBox::information( NULL, "Adaptive Region Growing functionality", "Please specify the image in Datamanager!");
    return;
  }

  mitk::DataNode::Pointer node = m_RegionGrow3DTool->GetPointSetNode();

  if (node.IsNull())
  {
    QMessageBox::information( NULL, "Adaptive Region Growing functionality", "Please insert a seed point inside the image.\n\nFirst press the \"Define Seed Point\" button,\nthen click left mouse button inside the image.");
    return;
  }

  //safety if no pointSet or pointSet empty
  mitk::PointSet::Pointer seedPointSet = dynamic_cast<mitk::PointSet*> (node->GetData());
  if (seedPointSet.IsNull())
  {
    m_Controls.m_pbRunSegmentation->setEnabled(true);
    QMessageBox::information( NULL, "Adaptive Region Growing functionality", "The seed point is empty! Please choose a new seed point.");
    return;
  }

  int timeStep = mitk::BaseRenderer::GetInstance( mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget1") )->GetTimeStep();

  if (!(seedPointSet->GetSize(timeStep)))
  {
    m_Controls.m_pbRunSegmentation->setEnabled(true);
    QMessageBox::information( NULL, "Adaptive Region Growing functionality", "The seed point is empty! Please choose a new seed point.");
    return;
  }

  QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) );

  mitk::PointSet::PointType seedPoint = seedPointSet->GetPointSet(timeStep)->GetPoints()->Begin().Value();

  mitk::Image::Pointer orgImage = dynamic_cast<mitk::Image*> (m_InputImageNode->GetData());

  if (orgImage.IsNotNull())
  {
      if (orgImage->GetDimension() == 4)
      {
          mitk::ImageTimeSelector::Pointer timeSelector = mitk::ImageTimeSelector::New();
          timeSelector->SetInput(orgImage);
          timeSelector->SetTimeNr( timeStep );
          timeSelector->UpdateLargestPossibleRegion();
          mitk::Image* timedImage = timeSelector->GetOutput();
          AccessByItk_2( timedImage , StartRegionGrowing, timedImage->GetGeometry(), seedPoint);
      }
      else if (orgImage->GetDimension() == 3)
      {
          //QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); //set the cursor to waiting
          AccessByItk_2(orgImage, StartRegionGrowing, orgImage->GetGeometry(), seedPoint);
          //QApplication::restoreOverrideCursor();//reset cursor
      }
      else
      {
          QApplication::restoreOverrideCursor();//reset cursor
          QMessageBox::information( NULL, "Adaptive Region Growing functionality", "Only images of dimension 3 or 4 can be processed!");
          return;
      }
  }
  EnableControls(true); // Segmentation ran successfully, so enable all controls.
  node->SetVisibility(true);
  QApplication::restoreOverrideCursor();//reset cursor

}
void QmitkFunctionality::BusyCursorOn()
{
  QApplication::setOverrideCursor( QCursor(Qt::BusyCursor) );
}
Example #5
0
QWidget*
StdWidgetFactory::createWidget(const QCString &c, QWidget *p, const char *n, 
	KFormDesigner::Container *container, int options)
{
	QWidget *w=0;
	QString text( container->form()->library()->textForWidgetName(n, c) );
	const bool designMode = options & KFormDesigner::WidgetFactory::DesignViewMode;

	if(c == "QLabel")
		w = new QLabel(text, p, n);
	else if(c == "KexiPictureLabel")
		w = new KexiPictureLabel(DesktopIcon("image"), p, n);

	else if(c == "KLineEdit")
	{
		w = new KLineEdit(p, n);
		if (designMode)
			w->setCursor(QCursor(Qt::ArrowCursor));
	}
	else if(c == "KPushButton")
		w = new KPushButton(/*i18n("Button")*/text, p, n);

	else if(c == "QRadioButton")
		w = new QRadioButton(/*i18n("Radio Button")*/text, p, n);

	else if(c == "QCheckBox")
		w = new QCheckBox(/*i18n("Check Box")*/text, p, n);

	else if(c == "KIntSpinBox")
		w = new KIntSpinBox(p, n);

	else if(c == "KComboBox")
		w = new KComboBox(p, n);

	else if(c == "KListBox")
		w = new KListBox(p, n);

	else if(c == "KTextEdit")
		w = new KTextEdit(/*i18n("Enter your text here")*/text, QString::null, p, n);

	else if(c == "KListView")
	{
		w = new KListView(p, n);
		if(container->form()->interactiveMode())
			((KListView*)w)->addColumn(i18n("Column 1"));
		((KListView*)w)->setRootIsDecorated(true);
	}
	else if(c == "QSlider")
		w = new QSlider(Qt::Horizontal, p, n);

	else if(c == "KProgress")
		w = new KProgress(p, n);

	else if(c == "KDateWidget")
		w = new KDateWidget(QDate::currentDate(), p, n);

	else if(c == "KTimeWidget")
		w = new KTimeWidget(QTime::currentTime(), p, n);

	else if(c == "KDateTimeWidget")
		w = new KDateTimeWidget(QDateTime::currentDateTime(), p, n);

	else if(c == "Line")
		w = new Line(options & WidgetFactory::VerticalOrientation ? Line::Vertical : Line::Horizontal, p, n);

	else if(c == "Spring") {
		w = new Spring(p, n);
		if (0 == (options & WidgetFactory::AnyOrientation))
			static_cast<Spring*>(w)->setOrientation(
				(options & WidgetFactory::VerticalOrientation) ? Qt::Vertical : Qt::Horizontal);
	}

	if(w)
		return w;

	kdDebug() << "WARNING :: w == 0 "  << endl;
	return 0;
}
Example #6
0
LoginUIBase::LoginUIBase( QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "frmLogin" );
    setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) );
    setSizeGripEnabled( FALSE );

    cancelBtn = new QPushButton( this, "cancelBtn" );
    cancelBtn->setGeometry( QRect( 210, 170, 70, 23 ) );

    tbNetSetup = new QToolButton( this, "tbNetSetup" );
    tbNetSetup->setGeometry( QRect( 9, 170, 51, 23 ) );
    tbNetSetup->setCursor( QCursor( 13 ) );
    tbNetSetup->setToggleButton( TRUE );
    tbNetSetup->setAutoRepeat( TRUE );
    tbNetSetup->setAutoRaise( TRUE );

    groupBox1 = new QGroupBox( this, "groupBox1" );
    groupBox1->setGeometry( QRect( 21, 51, 250, 115 ) );
    groupBox1->setColumnLayout(0, Qt::Vertical );
    groupBox1->layout()->setSpacing( 6 );
    groupBox1->layout()->setMargin( 11 );
    groupBox1Layout = new QGridLayout( groupBox1->layout() );
    groupBox1Layout->setAlignment( Qt::AlignTop );

    layout14 = new QHBoxLayout( 0, 0, 6, "layout14"); 
    spacer3 = new QSpacerItem( 21, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout14->addItem( spacer3 );

    layout9 = new QVBoxLayout( 0, 0, 6, "layout9"); 

    layout8 = new QHBoxLayout( 0, 0, 6, "layout8"); 

    layout7 = new QVBoxLayout( 0, 0, 6, "layout7"); 

    textLabel1 = new QLabel( groupBox1, "textLabel1" );
    layout7->addWidget( textLabel1 );

    textLabel2 = new QLabel( groupBox1, "textLabel2" );
    layout7->addWidget( textLabel2 );
    layout8->addLayout( layout7 );

    layout6 = new QVBoxLayout( 0, 0, 6, "layout6"); 

    cbQQ = new QComboBox( FALSE, groupBox1, "cbQQ" );
    cbQQ->setEditable( TRUE );
    layout6->addWidget( cbQQ );

    lePwd = new QLineEdit( groupBox1, "lePwd" );
    lePwd->setEchoMode( QLineEdit::Password );
    layout6->addWidget( lePwd );
    layout8->addLayout( layout6 );
    layout9->addLayout( layout8 );

    layout1 = new QHBoxLayout( 0, 0, 6, "layout1"); 
    spacer1 = new QSpacerItem( 41, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout1->addItem( spacer1 );

    chbRecordPwd = new QCheckBox( groupBox1, "chbRecordPwd" );
    layout1->addWidget( chbRecordPwd );

    chbLoginMode = new QCheckBox( groupBox1, "chbLoginMode" );
    layout1->addWidget( chbLoginMode );
    layout9->addLayout( layout1 );
    layout14->addLayout( layout9 );
    spacer2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout14->addItem( spacer2 );

    groupBox1Layout->addLayout( layout14, 0, 0 );

    line1 = new QFrame( this, "line1" );
    line1->setGeometry( QRect( 31, 204, 200, 16 ) );
    line1->setFrameShape( QFrame::HLine );
    line1->setFrameShadow( QFrame::Sunken );
    line1->setFrameShape( QFrame::HLine );

    lblType = new QLabel( this, "lblType" );
    lblType->setGeometry(QRect(20, 220, 106, 23));

    cbbLoginType = new QComboBox( FALSE, this, "cbbLoginType" );
    cbbLoginType->setGeometry(QRect(130, 220, 100, 23));

    loginBtn = new QPushButton( this, "loginBtn" );
    loginBtn->setGeometry( QRect( 127, 170, 61, 23 ) );
    loginBtn->setDefault(true);

    fraNetSetup = new QFrame( this, "fraNetSetup" );
    fraNetSetup->setGeometry( QRect( 1, 252, 290, 76 ) );
    fraNetSetup->setFrameShape( QFrame::StyledPanel );
    fraNetSetup->setFrameShadow( QFrame::Raised );
    fraNetSetupLayout = new QGridLayout( fraNetSetup, 1, 1, 11, 6, "fraNetSetupLayout"); 

    layout13 = new QVBoxLayout( 0, 0, 6, "layout13"); 

    layout12 = new QHBoxLayout( 0, 0, 6, "layout12"); 

    tlProxyServer = new QLabel( fraNetSetup, "tlProxyServer" );
    layout12->addWidget( tlProxyServer );

    leIP = new QLineEdit( fraNetSetup, "leIP" );
    leIP->setMaximumSize( QSize( 130, 32767 ) );
    layout12->addWidget( leIP );

    tlProxyPort = new QLabel( fraNetSetup, "tlProxyPort" );
    tlProxyPort->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, tlProxyPort->sizePolicy().hasHeightForWidth() ) );
    layout12->addWidget( tlProxyPort );

    lePort = new QLineEdit( fraNetSetup, "lePort" );
    lePort->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, lePort->sizePolicy().hasHeightForWidth() ) );
    lePort->setMaximumSize( QSize( 35, 32767 ) );
    layout12->addWidget( lePort );
    layout13->addLayout( layout12 );

    layout11 = new QHBoxLayout( 0, 0, 6, "layout11"); 

    tlUserName = new QLabel( fraNetSetup, "tlUserName" );
    tlUserName->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, tlUserName->sizePolicy().hasHeightForWidth() ) );
    layout11->addWidget( tlUserName );

    leUserName = new QLineEdit( fraNetSetup, "leUserName" );
    leUserName->setMaximumSize( QSize( 75, 32767 ) );
    layout11->addWidget( leUserName );

    tlPassword = new QLabel( fraNetSetup, "tlPassword" );
    tlPassword->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, tlPassword->sizePolicy().hasHeightForWidth() ) );
    layout11->addWidget( tlPassword );

    lePassword = new QLineEdit( fraNetSetup, "lePassword" );
    lePassword->setMaximumSize( QSize( 75, 32767 ) );
    lePassword->setEchoMode( QLineEdit::Password );
    layout11->addWidget( lePassword );
    layout13->addLayout( layout11 );

    fraNetSetupLayout->addLayout( layout13, 0, 0 );

    lblLogo = new QLabel( this, "lblLogo" );
    lblLogo->setGeometry( QRect( 0, 0, 292, 47 ) );
    lblLogo->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, lblLogo->sizePolicy().hasHeightForWidth() ) );
    lblLogo->setMaximumSize( QSize( 345, 32767 ) );
    lblLogo->setScaledContents( TRUE );
    languageChange();
    resize( QSize(292, 333).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( loginBtn, SIGNAL( clicked() ), this, SLOT( loginClickSlot() ) );
    connect( cancelBtn, SIGNAL( clicked() ), this, SLOT( cancelClickSlot() ) );
    //connect( tbNetSetup, SIGNAL( clicked() ), this, SLOT( tbNetSetupClicked() ) );
}
Example #7
0
bool XfigPlug::import(QString fNameIn, const TransactionSettings& trSettings, int flags, bool showProgress)
{
	QString fName = fNameIn;
	bool success = false;
	interactive = (flags & LoadSavePlugin::lfInteractive);
	importerFlags = flags;
	cancel = false;
	double x, y, b, h;
	bool ret = false;
	CustColors.clear();
	importedColors.insert(0, "Black");
	importedColors.insert(1, "Blue");
	importedColors.insert(2, "Green");
	importedColors.insert(3, "Cyan");
	importedColors.insert(4, "Red");
	importedColors.insert(5, "Magenta");
	importedColors.insert(6, "Yellow");
	importedColors.insert(7, "White");
	importedColors.insert(8, "Blue4");
	importedColors.insert(9, "Blue3");
	importedColors.insert(10, "Blue2");
	importedColors.insert(11, "LtBlue");
	importedColors.insert(12, "Green4");
	importedColors.insert(13, "Green3");
	importedColors.insert(14, "Green2");
	importedColors.insert(15, "Cyan4");
	importedColors.insert(16, "Cyan3");
	importedColors.insert(17, "Cyan2");
	importedColors.insert(18, "Red4");
	importedColors.insert(19, "Red3");
	importedColors.insert(20, "Red2");
	importedColors.insert(21, "Magenta4");
	importedColors.insert(22, "Magenta3");
	importedColors.insert(23, "Magenta2");
	importedColors.insert(24, "Brown4");
	importedColors.insert(25, "Brown3");
	importedColors.insert(26, "Brown2");
	importedColors.insert(27, "Pink4");
	importedColors.insert(28, "Pink3");
	importedColors.insert(29, "Pink2");
	importedColors.insert(30, "Pink");
	importedColors.insert(31, "Gold");
	CustColors.insert("Blue", ScColor(0, 0, 255));
	CustColors.insert("Blue4", ScColor(0, 0, 144));
	CustColors.insert("Blue3", ScColor(0, 0, 176));
	CustColors.insert("Blue2", ScColor(0, 0, 208));
	CustColors.insert("LtBlue", ScColor(135, 206, 255));
	CustColors.insert("Cyan", ScColor(255, 0, 0, 0));
	CustColors.insert("Cyan4", ScColor(0, 144, 144));
	CustColors.insert("Cyan3", ScColor(0, 176, 176));
	CustColors.insert("Cyan2", ScColor(0, 208, 208));
	CustColors.insert("Green", ScColor(255, 0, 255, 0));
	CustColors.insert("Green4", ScColor(0, 144, 0));
	CustColors.insert("Green3", ScColor(0, 176, 0));
	CustColors.insert("Green2", ScColor(0, 208, 0));
	CustColors.insert("Red", ScColor(0, 255, 255, 0));
	CustColors.insert("Red4", ScColor(144, 0, 0));
	CustColors.insert("Red3", ScColor(176, 0, 0));
	CustColors.insert("Red2", ScColor(208, 0, 0));
	CustColors.insert("Yellow", ScColor(0, 0, 255, 0));
	CustColors.insert("Magenta", ScColor(0, 255, 0, 0));
	CustColors.insert("Magenta4", ScColor(144, 0, 144));
	CustColors.insert("Magenta3", ScColor(176, 0, 176));
	CustColors.insert("Magenta2", ScColor(208, 0, 208));
	CustColors.insert("Brown4", ScColor(128, 48, 0));
	CustColors.insert("Brown3", ScColor(160, 64, 0));
	CustColors.insert("Brown2", ScColor(192, 96, 0));
	CustColors.insert("Pink4", ScColor(255, 128, 128));
	CustColors.insert("Pink3", ScColor(255, 160, 160));
	CustColors.insert("Pink2", ScColor(255, 192, 192));
	CustColors.insert("Pink", ScColor(255, 224, 224));
	CustColors.insert("Gold", ScColor(255, 215, 0));
	QFileInfo fi = QFileInfo(fName);
	if ( !ScCore->usingGUI() )
	{
		interactive = false;
		showProgress = false;
	}
	baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
	if ( showProgress )
	{
		ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
		progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
		QStringList barNames, barTexts;
		barNames << "GI";
		barTexts << tr("Analyzing File:");
		QList<bool> barsNumeric;
		barsNumeric << false;
		progressDialog->addExtraProgressBars(barNames, barTexts, barsNumeric);
		progressDialog->setOverallTotalSteps(3);
		progressDialog->setOverallProgress(0);
		progressDialog->setProgress("GI", 0);
		progressDialog->show();
		connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelRequested()));
		qApp->processEvents();
	}
	else
		progressDialog = NULL;
/* Set default Page to size defined in Preferences */
	x = 0.0;
	y = 0.0;
	b = 0.0;
	h = 0.0;
	if (progressDialog)
	{
		progressDialog->setOverallProgress(1);
		qApp->processEvents();
	}
	parseHeader(fName, x, y, b, h);
	docX = x;
	docY = y;
	if (b == 0.0)
		b = PrefsManager::instance()->appPrefs.docSetupPrefs.pageWidth;
	if (h == 0.0)
		h = PrefsManager::instance()->appPrefs.docSetupPrefs.pageHeight;
	docWidth = b - x;
	docHeight = h - y;
	baseX = 0;
	baseY = 0;
	if (!interactive || (flags & LoadSavePlugin::lfInsertPage))
	{
		m_Doc->setPage(b-x, h-y, 0, 0, 0, 0, 0, 0, false, false);
		m_Doc->addPage(0);
		m_Doc->view()->addPage(0, true);
		baseX = 0;
		baseY = 0;
	}
	else
	{
		if (!m_Doc || (flags & LoadSavePlugin::lfCreateDoc))
		{
			m_Doc=ScCore->primaryMainWindow()->doFileNew(b-x, h-y, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
			ScCore->primaryMainWindow()->HaveNewDoc();
			ret = true;
			baseX = 0;
			baseY = 0;
		}
	}
	if (flags & LoadSavePlugin::lfCreateDoc)
	{
		m_Doc->documentInfo().setAuthor(docCreator);
		m_Doc->documentInfo().setPublisher(docOrganisation);
		m_Doc->documentInfo().setTitle(docTitle);
		m_Doc->documentInfo().setDate(docDate+" "+docTime);
	}
	if ((!ret) && (interactive))
	{
		baseX = m_Doc->currentPage()->xOffset();
		baseY = m_Doc->currentPage()->yOffset();
	}
	if ((ret) || (!interactive))
	{
		if (b-x > h-y)
			m_Doc->setPageOrientation(1);
		else
			m_Doc->setPageOrientation(0);
		m_Doc->setPageSize("Custom");
	}
	if ((!(flags & LoadSavePlugin::lfLoadAsPattern)) && (m_Doc->view() != NULL))
		m_Doc->view()->Deselect();
	Elements.clear();
	m_Doc->setLoading(true);
	m_Doc->DoDrawing = false;
	if ((!(flags & LoadSavePlugin::lfLoadAsPattern)) && (m_Doc->view() != NULL))
		m_Doc->view()->updatesOn(false);
	m_Doc->scMW()->setScriptRunning(true);
	qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
	QString CurDirP = QDir::currentPath();
	QDir::setCurrent(fi.path());
	if (convert(fName))
	{
		tmpSel->clear();
		QDir::setCurrent(CurDirP);
		if ((Elements.count() > 1) && (!(importerFlags & LoadSavePlugin::lfCreateDoc)))
			m_Doc->groupObjectsList(Elements);
		m_Doc->DoDrawing = true;
		m_Doc->scMW()->setScriptRunning(false);
		m_Doc->setLoading(false);
		qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
		if ((Elements.count() > 0) && (!ret) && (interactive))
		{
			if (flags & LoadSavePlugin::lfScripted)
			{
				bool loadF = m_Doc->isLoading();
				m_Doc->setLoading(false);
				m_Doc->changed();
				m_Doc->setLoading(loadF);
				if (!(flags & LoadSavePlugin::lfLoadAsPattern))
				{
					m_Doc->m_Selection->delaySignalsOn();
					for (int dre=0; dre<Elements.count(); ++dre)
					{
						m_Doc->m_Selection->addItem(Elements.at(dre), true);
					}
					m_Doc->m_Selection->delaySignalsOff();
					m_Doc->m_Selection->setGroupRect();
					if (m_Doc->view() != NULL)
						m_Doc->view()->updatesOn(true);
				}
			}
			else
			{
				m_Doc->DragP = true;
				m_Doc->DraggedElem = 0;
				m_Doc->DragElements.clear();
				m_Doc->m_Selection->delaySignalsOn();
				for (int dre=0; dre<Elements.count(); ++dre)
				{
					tmpSel->addItem(Elements.at(dre), true);
				}
				tmpSel->setGroupRect();
				ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_Doc, tmpSel);
				m_Doc->itemSelection_DeleteItem(tmpSel);
				m_Doc->view()->updatesOn(true);
				m_Doc->m_Selection->delaySignalsOff();
				// We must copy the TransationSettings object as it is owned
				// by handleObjectImport method afterwards
				TransactionSettings* transacSettings = new TransactionSettings(trSettings);
				m_Doc->view()->handleObjectImport(md, transacSettings);
				m_Doc->DragP = false;
				m_Doc->DraggedElem = 0;
				m_Doc->DragElements.clear();
			}
		}
		else
		{
			m_Doc->changed();
			m_Doc->reformPages();
			if (!(flags & LoadSavePlugin::lfLoadAsPattern))
				m_Doc->view()->updatesOn(true);
		}
		success = true;
	}
	else
	{
		QDir::setCurrent(CurDirP);
		m_Doc->DoDrawing = true;
		m_Doc->scMW()->setScriptRunning(false);
		m_Doc->view()->updatesOn(true);
		qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
	}
	if (interactive)
		m_Doc->setLoading(false);
	//CB If we have a gui we must refresh it if we have used the progressbar
	if (!(flags & LoadSavePlugin::lfLoadAsPattern))
	{
		if ((showProgress) && (!interactive))
			m_Doc->view()->DrawNew();
	}
	qApp->restoreOverrideCursor();
	return success;
}
Example #8
0
void packages::sLoad()
{
  QProcess proc(this);
#ifdef Q_WS_MACX
  QString proc_path = QDir::cleanPath(qApp->applicationDirPath() +
                      "/../../../updater.app/Contents/MacOS/updater");
  QString proc_path2= QDir::cleanPath(qApp->applicationDirPath() +
                      "/../../../../Updater/updater.app/Contents/MacOS/updater");
#elif defined Q_WS_WIN
  QString proc_path = QDir::cleanPath(qApp->applicationDirPath() + "/updater.exe");
  QString proc_path2= QDir::cleanPath(qApp->applicationDirPath() + "/../Updater/updater.exe");
#else
  QString proc_path = QDir::cleanPath(qApp->applicationDirPath() + "/updater");
  QString proc_path2= QDir::cleanPath(qApp->applicationDirPath() + "/../Updater/updater");
#endif
  if (! QFile::exists(proc_path))
    proc_path = proc_path2;
  if (! QFile::exists(proc_path))
  {
#ifdef Q_WS_MACX
    if (QMessageBox::question(this, tr("Could Not Find Updater"),
                              tr("<p>xTuple ERP could not find the Updater "
                                 "application. Would you like to look for it?"),
                              QMessageBox::Yes | QMessageBox::Default,
                              QMessageBox::No) == QMessageBox::No)
      return;
#endif
    proc_path = QFileDialog::getOpenFileName(this,
                                             tr("Find Updater Application"));
    if (proc_path.isEmpty())
      return;
#ifdef Q_WS_MACX
    proc_path += "/Contents/MacOS/updater";
#endif
  }

  QStringList proc_args;
  QSqlDatabase db = QSqlDatabase::database();
  QString dbURL;
  buildDatabaseURL(dbURL, "QPSQL", db.hostName(), db.databaseName(),
                   QString::number(db.port()));
  proc_args << "-databaseURL=" + dbURL;
  if (! db.userName().isEmpty())
    proc_args << "-username="******"-passwd=" + db.password();

  QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
  proc.start(proc_path, proc_args);
  if (proc.waitForStarted() &&
      proc.waitForFinished(-1) &&
      proc.exitStatus() == QProcess::NormalExit &&
      proc.exitCode() == 0)
  {
    QApplication::restoreOverrideCursor();
    sFillList();
  }
  else
  {
    if (! db.password().isEmpty())
    {
      proc_args.removeLast();
      proc_args << "-passwd=XXXXX";
    }
    QApplication::restoreOverrideCursor();
    systemError(this,
                tr("<p>There was an error running the Updater program: "
                   "<br>%1 %2<br><br><pre>%3</pre>")
		  .arg(proc_path)
                  .arg(proc_args.join(" "))
		  .arg(QString(proc.readAllStandardError())));
    return;
  }

  sFillList();
}
Example #9
0
void login2::sLogin()
{
  QSqlDatabase db;

  QString databaseURL;
  databaseURL = _databaseURL;
  if (_demoOption->isChecked())
    databaseURL = _evalDatabaseURL.arg(_username->text().trimmed());
  else if(_cloudOption->isChecked())
    databaseURL = _cloudDatabaseURL.arg(_company->text().trimmed());

  QString protocol;
  QString hostName;
  QString dbName;
  QString port;
  parseDatabaseURL(databaseURL, protocol, hostName, dbName, port);

  if (_splash)
  {
    _splash->show();
    _splash->raise();
    _splash->showMessage(tr("Initializing the Database Connector"), SplashTextAlignment, SplashTextColor);
    qApp->processEvents();
  }

  // Open the Database Driver
  if (_multipleConnections)
    db = QSqlDatabase::addDatabase("QPSQL7", dbName);
  else
    db = QSqlDatabase::addDatabase("QPSQL7");
  if (!db.isValid())
  {
    if (_splash)
      _splash->hide();
    
    QMessageBox::warning( this, tr("No Database Driver"),
                          tr("<p>A connection could not be established with "
                             "the specified Database as the Proper Database "
                             "Drivers have not been installed. Contact your "
                             "Systems Administator."));
    
    return;
  }

  if(hostName.isEmpty() || dbName.isEmpty())
  {
    if (_splash)
      _splash->hide();
    
    QMessageBox::warning(this, tr("Incomplete Connection Options"),
                         tr("<p>One or more connection options are missing. "
                            "Please check that you have specified the host "
                            "name, database name, and any other required "
                            "options.") );

    return;
  }

  db.setDatabaseName(dbName);
  db.setHostName(hostName);
  db.setPort(port.toInt());

  _cUsername = _username->text().trimmed();
  _cPassword = _password->text().trimmed();
  _cCompany  = _company->text().trimmed();
  if(_cloudOption->isChecked())
  {
    if(_cCompany.isEmpty())
    {
      QMessageBox::warning(this, tr("Incomplete Connection Options"),
        tr("<p>You must specify the Company name to connect to the cloud."));
      return;
    }
    _cUsername = _cUsername + "_" + _cCompany;
  }

  db.setUserName(_cUsername);
  if(_demoOption->isChecked())
  {
    QString passwd = QMd5(QString(_cPassword + "private" + _cUsername)); 
    db.setPassword(passwd);
  }
  else if(_cloudOption->isChecked())
  {
    QString passwd = QMd5(QString(_cPassword + "cloudkey" + _cUsername)); 
    db.setPassword(passwd);
  }
  else
  {
    if(_enhancedAuth)
    {
      QString passwd = QMd5(QString(_cPassword + "xTuple" + _cUsername));
      db.setPassword(passwd);
    }
    else
      db.setPassword(_cPassword);

    if(_requireSSL)
      db.setConnectOptions("requiressl=1");
  }

  setCursor(QCursor(Qt::WaitCursor));

  if (_splash)
  {
    _splash->showMessage(tr("Connecting to the Database"), SplashTextAlignment, SplashTextColor);
    qApp->processEvents();
  }
  
  //  Try to connect to the Database
  bool result = db.open();
  if(!result && _enhancedAuth)
  {
    QString altpasswd = QMd5(QString(_cPassword + "OpenMFG" + _cUsername));
    db.setPassword(altpasswd);
    result = db.open();
    if(result)
    {
      altpasswd = QMd5(QString(_cPassword + "xTuple" + _cUsername));
      XSqlQuery chgpass(QString("ALTER USER %1 WITH PASSWORD '%2'").arg(_cUsername).arg(altpasswd));
    }
  }

  if (!result)
  {
    if(_requireSSL)
      db.setConnectOptions();

    if (_splash)
      _splash->hide();
    
    setCursor(QCursor(Qt::ArrowCursor));

    QMessageBox::critical(this, tr("Cannot Connect to xTuple ERP Server"),
                          tr("<p>Sorry, can't connect to the specified xTuple ERP server. "
                             "<p>This may be due to a problem with your user name, password, or server connection information. "
                             "<p>Below is more detail on the connection problem: "
                             "<p>%1" )
                            .arg(db.lastError().databaseText().replace('\n', "<br>") ));
    if (!_captive)
    {
      _username->setText("");
      _username->setFocus();
    }
    else
      _password->setFocus();

    _password->setText("");
    return;
  }

  xtsettingsSetValue("/xTuple/_demoOption", (bool)_demoOption->isChecked());
  xtsettingsSetValue("/xTuple/_cloudOption", (bool)_cloudOption->isChecked());
  xtsettingsSetValue("/xTuple/cloud_company", _company->text());

  if (_splash)
  {
    _splash->showMessage(tr("Logging into the Database"), SplashTextAlignment, SplashTextColor);
    qApp->processEvents();
  }
  
  if(!_nonxTupleDB)
  {
    XSqlQuery login( "SELECT login() AS result,"
                     "       CURRENT_USER AS user;" );
    setCursor(QCursor(Qt::ArrowCursor));
    if (login.first())
    {
      int result = login.value("result").toInt();
      if (result < 0)
      {
        if (_splash)
          _splash->hide();
        QMessageBox::critical(this, tr("Error Logging In"),
                              storedProcErrorLookup("login", result));
        return;
      }
      _user = login.value("user").toString();
      _databaseURL = databaseURL;
      updateRecentOptions();

      if (login.exec("SELECT getEffectiveXtUser() AS user;") &&
          login.first() &&
          ! login.value("user").toString().isEmpty())
        _user = login.value("user").toString();
      // no error check - older databases don't have getEffectiveXtUser

      accept();
    }
    else if (login.lastError().type() != QSqlError::NoError)
    {
      if (_splash)
        _splash->hide();
      QMessageBox::critical(this, tr("System Error"),
                            tr("A System Error occurred at %1::%2:\n%3")
                              .arg(__FILE__).arg(__LINE__)
                              .arg(login.lastError().databaseText()));
    }
    else
    {
      if (_splash)
        _splash->hide();
      
      QMessageBox::critical(this, tr("System Error"),
                            tr("<p>An unknown error occurred at %1::%2. You may"
                               " not log in to the specified xTuple ERP Server "
                               "at this time.")
                              .arg(__FILE__).arg(__LINE__));
    }
  }
  else
  {
    setCursor(QCursor(Qt::ArrowCursor));
    _databaseURL = databaseURL;
    updateRecentOptions();
    accept();
  }
}
Example #10
0
void Colordialog::mousePressEvent(QMouseEvent *event)
{
    mousepos = event->pos();
    grabMouse(QCursor(Qt::SizeAllCursor));
    raise();
}
Example #11
0
void PaymentView::on_table_customContextMenuRequested(const QPoint &pos)
{
    menu->exec(QCursor().pos());
}
Example #12
0
	LoginPage::LoginPage(QWidget* parent)
		: QWidget(parent)
		, country_code_(new LineEditEx(this))
		, phone_(new LineEditEx(this))
		, combobox_(new CountrySearchCombobox(this))
		, remaining_seconds_(0)
		, timer_(new QTimer(this))
	{
        setStyleSheet(Utils::LoadStyle(":/main_window/login_page.qss", Utils::get_scale_coefficient(), true));
        if (objectName().isEmpty())
            setObjectName(QStringLiteral("login_page"));
        setProperty("LoginPageWidget", QVariant(true));
        QVBoxLayout* verticalLayout = new QVBoxLayout(this);
        verticalLayout->setSpacing(0);
        verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
        verticalLayout->setContentsMargins(0, 0, 0, 0);
        
        auto back_button_widget = new QWidget(this);
        auto back_button_layout = new QHBoxLayout(back_button_widget);
        Utils::ApplyStyle(back_button_widget, "background-color: transparent;");
        back_button_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
        back_button_layout->setSpacing(0);
        back_button_layout->setContentsMargins(Utils::scale_value(14), Utils::scale_value(14), 0, 0);
        back_button_layout->setAlignment(Qt::AlignLeft);
        {
            prev_page_link_ = new BackButton(back_button_widget);
            prev_page_link_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
            prev_page_link_->setFlat(true);
            prev_page_link_->setFocusPolicy(Qt::NoFocus);
            prev_page_link_->setCursor(Qt::PointingHandCursor);
            {
                const QString s = "QPushButton { width: 20dip; height: 20dip; border: none; background-color: transparent; border-image: url(:/resources/contr_back_100.png); margin: 10dip; } QPushButton:hover { border-image: url(:/resources/contr_back_100_hover.png); } QPushButton#back_button:pressed { border-image: url(:/resources/contr_back_100_active.png); }";
                Utils::ApplyStyle(prev_page_link_, s);
            }
            back_button_layout->addWidget(prev_page_link_);
        }
        verticalLayout->addWidget(back_button_widget);
        
        /*
        QWidget* back_button_widget = new QWidget(this);
        back_button_widget->setObjectName(QStringLiteral("back_button_widget"));
        back_button_widget->setProperty("BackButtonWidget", QVariant(true));
        QHBoxLayout* back_button_layout = new QHBoxLayout(back_button_widget);
        back_button_layout->setSpacing(0);
        back_button_layout->setObjectName(QStringLiteral("back_button_layout"));
        back_button_layout->setContentsMargins(Utils::scale_value(14), Utils::scale_value(14), 0, 0);
        prev_page_link_ = new BackButton(back_button_widget);
        prev_page_link_->setObjectName(QStringLiteral("prev_page_link"));
        prev_page_link_->setCursor(QCursor(Qt::PointingHandCursor));
        prev_page_link_->setProperty("LoginBackButton", QVariant(true));
        back_button_layout->addWidget(prev_page_link_);
        
        QSpacerItem* horizontalSpacer_3 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
        back_button_layout->addItem(horizontalSpacer_3);

        verticalLayout->addWidget(back_button_widget);
        */
         
        QSpacerItem* verticalSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
        
        verticalLayout->addItem(verticalSpacer);
        
        QWidget* main_widget = new QWidget(this);
        main_widget->setObjectName(QStringLiteral("main_widget"));
        QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
        sizePolicy.setHorizontalStretch(0);
        sizePolicy.setVerticalStretch(0);
        sizePolicy.setHeightForWidth(main_widget->sizePolicy().hasHeightForWidth());
        main_widget->setSizePolicy(sizePolicy);
        main_widget->setProperty("CenterControlWidgetBack", QVariant(true));
        QHBoxLayout* main_layout = new QHBoxLayout(main_widget);
        main_layout->setSpacing(0);
        main_layout->setObjectName(QStringLiteral("main_layout"));
        main_layout->setContentsMargins(0, 0, 0, 0);
        QSpacerItem* horizontalSpacer_6 = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
        
        main_layout->addItem(horizontalSpacer_6);
        
        QWidget* controls_widget = new QWidget(main_widget);
        controls_widget->setObjectName(QStringLiteral("controls_widget"));
        QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Minimum);
        sizePolicy1.setHorizontalStretch(0);
        sizePolicy1.setVerticalStretch(0);
        sizePolicy1.setHeightForWidth(controls_widget->sizePolicy().hasHeightForWidth());
        controls_widget->setSizePolicy(sizePolicy1);
        controls_widget->setProperty("CenterContolWidget", QVariant(true));
        QVBoxLayout* controls_layout = new QVBoxLayout(controls_widget);
        controls_layout->setSpacing(0);
        controls_layout->setObjectName(QStringLiteral("controls_layout"));
        controls_layout->setContentsMargins(0, 0, 0, 0);
        PictureWidget* logo_widget = new PictureWidget(controls_widget, ":/resources/main_window/content_logo_100.png");
        logo_widget->setFixedHeight(Utils::scale_value(80));
        logo_widget->setFixedWidth(Utils::scale_value(80));
        controls_layout->addWidget(logo_widget);
        controls_layout->setAlignment(logo_widget, Qt::AlignHCenter);
        
        QLabel* welcome_label = new QLabel(controls_widget);
        welcome_label->setObjectName(QStringLiteral("welcome_label"));
        welcome_label->setAlignment(Qt::AlignCenter);
        welcome_label->setProperty("WelcomeTitle", QVariant(true));
        
        controls_layout->addWidget(welcome_label);
        
        hint_label_ = new QLabel(controls_widget);
        hint_label_->setObjectName(QStringLiteral("hint_label"));
        hint_label_->setAlignment(Qt::AlignCenter);
        hint_label_->setProperty("ActionHintLabel", QVariant(true));
        
        controls_layout->addWidget(hint_label_);
        
        QWidget * center_widget = new QWidget(controls_widget);
        center_widget->setObjectName(QStringLiteral("center_widget"));
        QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred);
        sizePolicy2.setHorizontalStretch(0);
        sizePolicy2.setVerticalStretch(0);
        sizePolicy2.setHeightForWidth(center_widget->sizePolicy().hasHeightForWidth());
        center_widget->setSizePolicy(sizePolicy2);
        QHBoxLayout * horizontalLayout = new QHBoxLayout(center_widget);
        horizontalLayout->setSpacing(0);
        horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
        horizontalLayout->setContentsMargins(0, 0, 0, 0);
        QSpacerItem* horizontalSpacer_9 = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
        
        horizontalLayout->addItem(horizontalSpacer_9);
        
        login_staked_widget_ = new QStackedWidget(center_widget);
        login_staked_widget_->setObjectName(QStringLiteral("login_staked_widget"));
        login_staked_widget_->setProperty("LoginStackedWidget", QVariant(true));
        QSizePolicy sizePolicy3(QSizePolicy::Fixed, QSizePolicy::Preferred);
        sizePolicy3.setHorizontalStretch(0);
        sizePolicy3.setVerticalStretch(0);
        sizePolicy3.setHeightForWidth(login_staked_widget_->sizePolicy().hasHeightForWidth());
        login_staked_widget_->setSizePolicy(sizePolicy3);
        QWidget* phone_login_widget = new QWidget();
        phone_login_widget->setObjectName(QStringLiteral("phone_login_widget"));
        sizePolicy3.setHeightForWidth(phone_login_widget->sizePolicy().hasHeightForWidth());
        phone_login_widget->setSizePolicy(sizePolicy3);
        QVBoxLayout* phone_login_layout = new QVBoxLayout(phone_login_widget);
        phone_login_layout->setSpacing(0);
        phone_login_layout->setObjectName(QStringLiteral("phone_login_layout"));
        phone_login_layout->setContentsMargins(0, 0, 0, 0);
        
        country_search_widget_ = new QWidget(phone_login_widget);
        country_search_widget_->setObjectName(QStringLiteral("country_search_widget"));
        country_search_widget_->setProperty("CountrySearchWidget", QVariant(true));
        QVBoxLayout* country_search_layout = new QVBoxLayout(country_search_widget_);
        country_search_layout->setSpacing(0);
        country_search_layout->setObjectName(QStringLiteral("country_search_layout"));
        country_search_layout->setContentsMargins(0, 0, 0, 0);
        
        phone_login_layout->addWidget(country_search_widget_);
        
        phone_widget_ = new QFrame(phone_login_widget);
        phone_widget_->setObjectName(QStringLiteral("phone_widget"));
        phone_widget_->setFocusPolicy(Qt::ClickFocus);
        phone_widget_->setFrameShape(QFrame::NoFrame);
        phone_widget_->setFrameShadow(QFrame::Plain);
        phone_widget_->setLineWidth(0);
        phone_widget_->setProperty("EnterPhoneWidget", QVariant(true));
        QHBoxLayout* phone_widget_layout = new QHBoxLayout(phone_widget_);
        phone_widget_layout->setSpacing(0);
        phone_widget_layout->setObjectName(QStringLiteral("phone_widget_layout"));
        phone_widget_layout->setContentsMargins(0, 0, 0, 0);
        
        phone_login_layout->addWidget(phone_widget_);
        
        QSpacerItem* verticalSpacer_3 = new QSpacerItem(20, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
        
        phone_login_layout->addItem(verticalSpacer_3);
        
        login_staked_widget_->addWidget(phone_login_widget);
        QWidget* phone_confirm_widget = new QWidget();
        phone_confirm_widget->setObjectName(QStringLiteral("phone_confirm_widget"));
        sizePolicy3.setHeightForWidth(phone_confirm_widget->sizePolicy().hasHeightForWidth());
        phone_confirm_widget->setSizePolicy(sizePolicy3);
        QVBoxLayout* phone_confirm_layout = new QVBoxLayout(phone_confirm_widget);
        phone_confirm_layout->setSpacing(0);
        phone_confirm_layout->setObjectName(QStringLiteral("phone_confirm_layout"));
        phone_confirm_layout->setContentsMargins(0, 0, 0, 0);
        
        QWidget* entered_phone_widget = new QWidget(phone_confirm_widget);
        entered_phone_widget->setObjectName(QStringLiteral("entered_phone_widget"));
        entered_phone_widget->setProperty("EnteredPhoneWidget", QVariant(true));
        QHBoxLayout* horizontalLayout_6 = new QHBoxLayout(entered_phone_widget);
        horizontalLayout_6->setSpacing(0);
        horizontalLayout_6->setObjectName(QStringLiteral("horizontalLayout_6"));
        horizontalLayout_6->setContentsMargins(0, 0, 0, 0);
        QSpacerItem* horizontalSpacer_4 = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
        
        horizontalLayout_6->addItem(horizontalSpacer_4);
        
        entered_phone_ = new QLabel(entered_phone_widget);
        entered_phone_->setObjectName(QStringLiteral("entered_phone"));
        entered_phone_->setProperty("EnteredPhoneNumber", QVariant(true));
        
        horizontalLayout_6->addWidget(entered_phone_);
        
        edit_phone_button_ = new QPushButton(entered_phone_widget);
        edit_phone_button_->setObjectName(QStringLiteral("edit_phone_button"));
        edit_phone_button_->setCursor(QCursor(Qt::PointingHandCursor));
        edit_phone_button_->setProperty("EditPhoneButton", QVariant(true));
        
        horizontalLayout_6->addWidget(edit_phone_button_);
        
        QSpacerItem* horizontalSpacer_5 = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
        
        horizontalLayout_6->addItem(horizontalSpacer_5);
        
        phone_confirm_layout->addWidget(entered_phone_widget);
        
        resend_button_ = new QPushButton(phone_confirm_widget);
        resend_button_->setObjectName(QStringLiteral("resendButton"));
        resend_button_->setCursor(QCursor(Qt::PointingHandCursor));
        resend_button_->setFocusPolicy(Qt::StrongFocus);
        resend_button_->setProperty("ResendCodeButton", QVariant(true));
        
        phone_confirm_layout->addWidget(resend_button_);
        
        code_edit_ = new QLineEdit(phone_confirm_widget);
        code_edit_->setObjectName(QStringLiteral("code_edit"));
        code_edit_->setAlignment(Qt::AlignCenter);
        code_edit_->setProperty("EnteredCode", QVariant(true));
        code_edit_->setAttribute(Qt::WA_MacShowFocusRect, false);
        Testing::setAccessibleName(code_edit_, "StartWindowSMScodeField");
        
        phone_confirm_layout->addWidget(code_edit_);
        
        QSpacerItem* verticalSpacer_4 = new QSpacerItem(20, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
        
        phone_confirm_layout->addItem(verticalSpacer_4);
        
        login_staked_widget_->addWidget(phone_confirm_widget);
        QWidget* uin_login_widget = new QWidget();
        uin_login_widget->setObjectName(QStringLiteral("uin_login_widget"));
        sizePolicy3.setHeightForWidth(uin_login_widget->sizePolicy().hasHeightForWidth());
        uin_login_widget->setSizePolicy(sizePolicy3);
        QVBoxLayout * uin_login_layout = new QVBoxLayout(uin_login_widget);
        uin_login_layout->setSpacing(0);
        uin_login_layout->setObjectName(QStringLiteral("uin_login_layout"));
        uin_login_layout->setContentsMargins(0, 0, 0, 0);
        
        uin_login_edit_ = new QLineEdit(uin_login_widget);
        uin_login_edit_->setObjectName(QStringLiteral("uin_login_edit"));
        uin_login_edit_->setAlignment(Qt::AlignLeft);
        uin_login_edit_->setProperty("Uin", QVariant(true));
        Testing::setAccessibleName(uin_login_edit_, "StartWindowUinField");
        
        uin_login_layout->addWidget(uin_login_edit_);
        
        uin_password_edit_ = new QLineEdit(uin_login_widget);
        uin_password_edit_->setObjectName(QStringLiteral("uin_password_edit"));
        uin_password_edit_->setEchoMode(QLineEdit::Password);
        uin_password_edit_->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
        uin_password_edit_->setProperty("Password", QVariant(true));
        Testing::setAccessibleName(uin_password_edit_, "StartWindowPasswordField");
        
        uin_login_layout->addWidget(uin_password_edit_);
        
        keep_logged_ = new QCheckBox(uin_login_widget);
        keep_logged_->setObjectName(QStringLiteral("keep_logged"));
        uin_login_layout->addWidget(keep_logged_);
        
        login_staked_widget_->addWidget(uin_login_widget);
        
        horizontalLayout->addWidget(login_staked_widget_);
        
        QSpacerItem* horizontalSpacer_8 = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
        
        horizontalLayout->addItem(horizontalSpacer_8);
        
        controls_layout->addWidget(center_widget);
        
        QWidget* next_button_widget = new QWidget(controls_widget);
        next_button_widget->setObjectName(QStringLiteral("next_button_widget"));
        next_button_widget->setProperty("NextButtonWidget", QVariant(true));
        QVBoxLayout* verticalLayout_8 = new QVBoxLayout(next_button_widget);
        verticalLayout_8->setSpacing(0);
        verticalLayout_8->setObjectName(QStringLiteral("verticalLayout_8"));
        verticalLayout_8->setContentsMargins(0, 0, 0, 0);
        next_page_link_ = new QPushButton(next_button_widget);
        next_page_link_->setObjectName(QStringLiteral("next_page_link"));
        next_page_link_->setCursor(QCursor(Qt::PointingHandCursor));
        next_page_link_->setAutoDefault(true);
        next_page_link_->setDefault(false);
		Utils::ApplyStyle(next_page_link_, main_button_style);
        Testing::setAccessibleName(next_page_link_, "StartWindowLoginButton");
        
        verticalLayout_8->addWidget(next_page_link_);
        
        controls_layout->addWidget(next_button_widget);
		controls_layout->setAlignment(next_button_widget, Qt::AlignHCenter);

        QWidget* widget = new QWidget(controls_widget);
        widget->setObjectName(QStringLiteral("widget"));
        widget->setProperty("ErrorWIdget", QVariant(true));
        QVBoxLayout* verticalLayout_7 = new QVBoxLayout(widget);
        verticalLayout_7->setSpacing(0);
        verticalLayout_7->setObjectName(QStringLiteral("verticalLayout_7"));
        verticalLayout_7->setContentsMargins(0, 0, 0, 0);
        error_label_ = new QLabel(widget);
        error_label_->setObjectName(QStringLiteral("error_label"));
        error_label_->setAlignment(Qt::AlignCenter);
        error_label_->setProperty("ErrorLabel", QVariant(true));
        
        verticalLayout_7->addWidget(error_label_);
        
        controls_layout->addWidget(widget);
        
        main_layout->addWidget(controls_widget);
        
        QSpacerItem* horizontalSpacer_7 = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
        
        main_layout->addItem(horizontalSpacer_7);
        
        verticalLayout->addWidget(main_widget);
        
        QSpacerItem* verticalSpacer_2 = new QSpacerItem(0, 3, QSizePolicy::Minimum, QSizePolicy::Expanding);
        
        verticalLayout->addItem(verticalSpacer_2);
        
        QWidget* switch_login_widget = new QWidget(this);
        switch_login_widget->setObjectName(QStringLiteral("switch_login_widget"));
        switch_login_widget->setProperty("LoginButtonWidget", QVariant(true));
        QHBoxLayout* switch_login_layout = new QHBoxLayout(switch_login_widget);
        switch_login_layout->setSpacing(0);
        switch_login_layout->setObjectName(QStringLiteral("switch_login_layout"));
        switch_login_layout->setContentsMargins(0, 0, 0, 0);
        QSpacerItem* horizontalSpacer = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
        
        switch_login_layout->addItem(horizontalSpacer);
        
        switch_login_link_ = new QPushButton(switch_login_widget);
        switch_login_link_->setObjectName(QStringLiteral("switch_login_link"));
        sizePolicy1.setHeightForWidth(switch_login_link_->sizePolicy().hasHeightForWidth());
        switch_login_link_->setSizePolicy(sizePolicy1);
        switch_login_link_->setCursor(QCursor(Qt::PointingHandCursor));
        switch_login_link_->setProperty("SwitchLoginButton", QVariant(true));
        Testing::setAccessibleName(switch_login_link_, "StartWindowChangeLoginType");
        
        switch_login_layout->addWidget(switch_login_link_);
        
        QSpacerItem* horizontalSpacer_2 = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
        
        switch_login_layout->addItem(horizontalSpacer_2);
        
        verticalLayout->addWidget(switch_login_widget);
        
        login_staked_widget_->setCurrentIndex(2);
        
        QMetaObject::connectSlotsByName(this);
        
        //prev_page_link_->setText(QString());
        welcome_label->setText(QT_TRANSLATE_NOOP("login_page","Welcome to ICQ"));
        edit_phone_button_->setText(QT_TRANSLATE_NOOP("login_page","Edit"));
        code_edit_->setPlaceholderText(QT_TRANSLATE_NOOP("login_page","Your code"));
        uin_login_edit_->setPlaceholderText(QT_TRANSLATE_NOOP("login_page","UIN or Email"));
        uin_login_edit_->setAttribute(Qt::WA_MacShowFocusRect, false);
        uin_password_edit_->setPlaceholderText(QT_TRANSLATE_NOOP("login_page","Password"));
        uin_password_edit_->setAttribute(Qt::WA_MacShowFocusRect, false);
        
        keep_logged_->setText(QT_TRANSLATE_NOOP("login_page","Keep me signed in"));
        keep_logged_->setChecked(get_gui_settings()->get_value(settings_keep_logged_in, true));
        connect(keep_logged_, &QCheckBox::toggled, [](bool v)
        {
            if (get_gui_settings()->get_value(settings_keep_logged_in, true) != v)
                get_gui_settings()->set_value(settings_keep_logged_in, v);
        });
        
        next_page_link_->setText(QT_TRANSLATE_NOOP("login_page","Continue"));
        Q_UNUSED(this);
        
        login_staked_widget_->setCurrentIndex(2);
        next_page_link_->setDefault(false);
        
        QMetaObject::connectSlotsByName(this);
		init();
	}
Example #13
0
Editor::Editor(int startX, int startY, int width, int height, QColor fontColor, int fontSize, QFont fontFamily,
               qreal gopacity, bool gclickMuted, bool gmusicMuted)
{
    clickObject = new Phonon::MediaObject(this);
    clickObject->setCurrentSource(currentClick);
    clickOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
    Phonon::createPath(clickObject, clickOutput);
    clickMuted = gclickMuted;
    musicObject = new Phonon::MediaObject(this);
    musicObject->setCurrentSource(currentMusic);
    musicOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
    Phonon::createPath(musicObject, musicOutput);
    connect(musicObject, SIGNAL(aboutToFinish()), this, SLOT(replayMusic(void)));
    musicMuted = gmusicMuted;
    timer = new QTimer(this);
    timer->start(60000*3); //autosave every 3 min
    currentFile = "";
    connect(timer, SIGNAL(timeout()), this, SLOT(autoSave()));
    saved = true;
    rect = QRect(startX,startY,width,height); //Default size of border
    opacity = gopacity;
    text = new QTextEdit(this);
    text->setGeometry(rect.x()+1,rect.y()+1,rect.width()-1,rect.height()-1); //Draw text edit 1 pixel smaller than border
    text->viewport()->setAutoFillBackground(false); //make trsparent background but not text
    text->setFrameShape(QFrame::NoFrame); //hide frame
/***************************************************************
    text->setStyleSheet(
            "QScrollBar:vertical {"
                  "border: 0px;"
                  "background: transparent;"
                  "width: 15px;"
                  "margin: 22px 0 22px 0;"
              "}"
              "QScrollBar::handle:vertical {"
                  "border: 1px solid" + currentTextColor.name() + ";"
                  "background: transparent;"
                  "min-height: 20px;"
              "}"
              "QScrollBar::add-line:vertical {"
                  "border: 0px;"
                  "background: transparent;"
                  "height: 20px;"
                  "subcontrol-position: bottom;"
                  "subcontrol-origin: margin;"
              "}"

              "QScrollBar::sub-line:vertical {"
                  "border: 0px;"
                  "background: transparent;"
                  "height: 20px;"
                  "subcontrol-position: top;"
                  "subcontrol-origin: margin;"
              "}"

              "QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical {"
                  "border: 2px solid" + currentTextColor.name() + ";"
                  "width: 3px;"
                  "height: 3px;"
                  "background:" + currentTextColor.name() + ";"
              "}"

              "QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {"
                  "background: none;"
              "}"

              "QScrollBar:horizontal {"
                  "border: 0px;"
                  "background: transparent;"
                  "height: 15px;"
                  "margin: 0px 22px 0 22px;"
              "}"

              "QScrollBar::handle:horizontal {"
                  "border: 1px solid" + currentTextColor.name() + ";"
                  "background: transparent;"
                  "min-width: 20px;"
              "}"

              "QScrollBar::add-line:horizontal {"
                  "border: 0px;"
                  "background: transparent;"
                  "width: 20px;"
                  "subcontrol-position: right;"
                  "subcontrol-origin: margin;"
              "}"

              "QScrollBar::sub-line:horizontal {"
                  "border: 0px;"
                  "background: transparent;"
                  "width: 20px;"
                  "subcontrol-position: left;"
                  "subcontrol-origin: margin;"
              "}"

              "QScrollBar::left-arrow:horizontal, QScrollBar::right-arrow:horizontal {"
                  "border: 2px solid" + currentTextColor.name() + ";"
                  "width: 3px;"
                  "height: 3px;"
                  "background:" + currentTextColor.name() + ";"
              "}"

              "QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {"
                   "background: none;"
              "}"
    );
*****************************************************************/
    text->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //To make KoalaWriter behave like OmmWriter
    cursor = QCursor();
    this->setMouseTracking(true); //Permit mouse tracking also if no button is pressed

    //Define all handle 6x6 square center in the rect angle and in half side
    handleTL = QRect(QPoint(rect.topLeft().x()-3,rect.topLeft().y()-3),QSize(6,6));
    handleT = QRect(QPoint(rect.center().x()-3,rect.top()-3),QSize(6,6));
    handleTR = QRect(QPoint(rect.topRight().x()-3,rect.topRight().y()-3),QSize(6,6));
    handleL = QRect(QPoint(rect.left()-3,rect.center().y()-3),QSize(6,6));
    handleR = QRect(QPoint(rect.right()-3,rect.center().y()-3),QSize(6,6));
    handleBL = QRect(QPoint(rect.bottomLeft().x()-3,rect.bottomLeft().y()-3),QSize(6,6));
    handleB = QRect(QPoint(rect.center().x()-3,rect.bottom()-3),QSize(6,6));
    handleBR = QRect(QPoint(rect.bottomRight().x()-3,rect.bottomRight().y()-3),QSize(6,6));
    resizingTL = false;
    resizingTR = false;
    resizingBL = false;
    resizingBR = false;
    resizingT = false;
    resizingB = false;
    resizingL = false;
    resizingR = false;
    move = false;


    //Offset for spacing elements
    xOffset = 35;
    yOffset = 35;

    // Opacity slider
    slider = new QSlider(Qt::Horizontal, this);
    slider->setStyleSheet(
            "QSlider::groove:horizontal {"
                 "border: 2px solid white;"
                 "height: 6px;"
                 "background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #424242, stop:1 black);"
                 "margin: 3px 0;"
                 "border-radius: 3px;"
             "}"

             "QSlider::handle:horizontal {"
                 "background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #424242, stop:1 black);"
                 "border: 2px solid white;"
                 "width: 18px;"
                 "margin: -2px 0;"
                 "border-radius: 3px;"
             "}"
    );
    slider->setGeometry(rect.center().x()-60, rect.bottom()+10, 120, 20);
    slider->setRange(0, 10);
    slider->setValue(int(opacity*10));
    connect(slider, SIGNAL(sliderMoved(int)), this, SLOT(setBackgroundOpacity(int)));

    //Draw all option button
    textB = new QPushButton(QIcon(":/buttons/Icons/text.png"),"", this);
    textB->setIconSize(QSize(32,32));
    textB->setGeometry(rect.right()+xOffset,startY,32,32);
    textB->setMouseTracking(true);

    fontComboBox = new QFontComboBox(this);
    fontComboBox->hide();
    fontComboBox->setStyleSheet(
            "QComboBox {"
                "border: 1px solid black;"
                "border-radius: 3px;"
             "}"

             "QComboBox::drop-down {"
                "width: 32px;"
                "border-top-right-radius: 3px;"
                "border-bottom-right-radius: 3px;"
             "}"

             "QComboBox::down-arrow {"
                "image: url(:/buttons/Icons/down_arrow.png);"
                "width: 32;"
                "height: 32;"
             "}"
    );
    fontComboBox->setGeometry(rect.right()+2*xOffset,startY,180,32);

    textColorB = new QPushButton(QIcon(":/buttons/Icons/color.png"),"", this);
    textColorB->hide();
    textColorB->setIconSize(QSize(32,32));
    textColorB->setGeometry(rect.right()+2*xOffset+183,startY,32,32);

    textBDimension = new QPushButton(QIcon(":/buttons/Icons/text_dimension.png"),"", this);
    textBDimension->setIconSize(QSize(32,32));
    textBDimension->setGeometry(rect.right()+xOffset,startY+yOffset,32,32);
    textBDimension->setMouseTracking(true);

    textLessB = new QPushButton(QIcon(":/buttons/Icons/text_less.png"),"", this);
    textLessB->hide();
    textLessB->setIconSize(QSize(32,32));
    textLessB->setGeometry(rect.right()+2*xOffset,startY+yOffset,32,32);

    textDefaultB = new QPushButton(QIcon(":/buttons/Icons/text_default.png"),"", this);
    textDefaultB->hide();
    textDefaultB->setIconSize(QSize(32,32));
    textDefaultB->setGeometry(rect.right()+3*xOffset,startY+yOffset,32,32);

    textMoreB = new QPushButton(QIcon(":/buttons/Icons/text_more.png"),"", this);
    textMoreB->hide();
    textMoreB->setIconSize(QSize(32,32));
    textMoreB->setGeometry(rect.right()+4*xOffset,startY+yOffset,32,32);

    backgroundB = new QPushButton(QIcon(":/buttons/Icons/background.png"),"", this);
    backgroundB->setIconSize(QSize(32,32));
    backgroundB->setGeometry(rect.right()+xOffset,startY+2*yOffset,32,32);
    backgroundB->setMouseTracking(true);

    backgroundPreviousB = new QPushButton(QIcon(":/buttons/Icons/sx.png"),"", this);
    backgroundPreviousB->hide();
    backgroundPreviousB->setIconSize(QSize(32,32));
    backgroundPreviousB->setGeometry(rect.right()+2*xOffset,startY+2*yOffset,32,32);

    backgroundNextB = new QPushButton(QIcon(":/buttons/Icons/dx.png"),"", this);
    backgroundNextB->hide();
    backgroundNextB->setIconSize(QSize(32,32));
    backgroundNextB->setGeometry(rect.right()+3*xOffset,startY+2*yOffset,32,32);

    backgroundColorB = new QPushButton(QIcon(":/buttons/Icons/color.png"),"", this);
    backgroundColorB->hide();
    backgroundColorB->setIconSize(QSize(32,32));
    backgroundColorB->setGeometry(rect.right()+4*xOffset,startY+2*yOffset,32,32);

    musicB = new QPushButton(QIcon(":/buttons/Icons/music.png"),"", this);
    musicB->setIconSize(QSize(32,32));
    musicB->setGeometry(rect.right()+xOffset,startY+3*yOffset,32,32);
    musicB->setMouseTracking(true);

    musicPreviousB = new QPushButton(QIcon(":/buttons/Icons/sx.png"),"", this);
    musicPreviousB->hide();
    musicPreviousB->setIconSize(QSize(32,32));
    musicPreviousB->setGeometry(rect.right()+2*xOffset,startY+3*yOffset,32,32);

    musicNextB = new QPushButton(QIcon(":/buttons/Icons/dx.png"),"", this);
    musicNextB->hide();
    musicNextB->setIconSize(QSize(32,32));
    musicNextB->setGeometry(rect.right()+3*xOffset,startY+3*yOffset,32,32);

    if(musicMuted)
        musicMuteB = new QPushButton(QIcon(":/buttons/Icons/mute_red.png"),"", this);
    else
        musicMuteB = new QPushButton(QIcon(":/buttons/Icons/mute.png"),"", this);
    musicMuteB->hide();
    musicMuteB->setIconSize(QSize(32,32));
    musicMuteB->setGeometry(rect.right()+4*xOffset,startY+3*yOffset,32,32);

    keyboardB = new QPushButton(QIcon(":/buttons/Icons/keyboard.png"),"", this);
    keyboardB->setIconSize(QSize(32,32));
    keyboardB->setGeometry(rect.right()+xOffset,startY+4*yOffset,32,32);
    keyboardB->setMouseTracking(true);

    keyboardPreviousB = new QPushButton(QIcon(":/buttons/Icons/sx.png"),"", this);
    keyboardPreviousB->hide();
    keyboardPreviousB->setIconSize(QSize(32,32));
    keyboardPreviousB->setGeometry(rect.right()+2*xOffset,startY+4*yOffset,32,32);

    keyboardNextB = new QPushButton(QIcon(":/buttons/Icons/dx.png"),"", this);
    keyboardNextB->hide();
    keyboardNextB->setIconSize(QSize(32,32));
    keyboardNextB->setGeometry(rect.right()+3*xOffset,startY+4*yOffset,32,32);

    if(clickMuted)
        keyboardMuteB = new QPushButton(QIcon(":/buttons/Icons/mute_red.png"),"", this);
    else
        keyboardMuteB = new QPushButton(QIcon(":/buttons/Icons/mute.png"),"", this);
    keyboardMuteB->hide();
    keyboardMuteB->setIconSize(QSize(32,32));
    keyboardMuteB->setGeometry(rect.right()+4*xOffset,startY+4*yOffset,32,32);

    fileB = new QPushButton(QIcon(":/buttons/Icons/file.png"),"", this);
    fileB->setIconSize(QSize(32,32));
    fileB->setGeometry(rect.right()+xOffset,startY+5*yOffset,32,32);
    fileB->setMouseTracking(true);

    loadB = new QPushButton(QIcon(":/buttons/Icons/load.png"),"", this);
    loadB->hide();
    loadB->setIconSize(QSize(32,32));
    loadB->setGeometry(rect.right()+2*xOffset,startY+5*yOffset,32,32);
    loadB->setMouseTracking(true);

    saveB = new QPushButton(QIcon(":/buttons/Icons/save.png"),"", this);
    saveB->hide();
    saveB->setIconSize(QSize(32,32));
    saveB->setGeometry(rect.right()+3*xOffset,startY+5*yOffset,32,32);

    saveAsB = new QPushButton(QIcon(":/buttons/Icons/save_as.png"),"", this);
    saveAsB->hide();
    saveAsB->setIconSize(QSize(32,32));
    saveAsB->setGeometry(rect.right()+4*xOffset,startY+5*yOffset,32,32);

    colorDialog = new QColorDialog();
    defaultTextDimension = 14;
    currentTextDimension = fontSize;
    currentFont = fontFamily;

    currentTextColor = fontColor;
    this->updateTextStyle();

    //Hidden interface
    hide = false;

    //Signals
    connect(text->document(), SIGNAL(contentsChanged()), this, SLOT(documentWasModified()));
    connect(fontComboBox, SIGNAL(currentFontChanged(const QFont&)), this, SLOT(changeTextFont(const QFont&)));
    connect(textColorB,SIGNAL(clicked()),this,SLOT(showColorDialog(void)));
    connect(textLessB,SIGNAL(clicked()),this,SLOT(lessText(void)));
    connect(textDefaultB,SIGNAL(clicked()),this,SLOT(defaultText(void)));
    connect(textMoreB,SIGNAL(clicked()),this,SLOT(moreText(void)));
    connect(loadB,SIGNAL(clicked()),this,SLOT(open(void)));
    connect(saveB,SIGNAL(clicked()),this,SLOT(save(void)));
    connect(saveAsB,SIGNAL(clicked()),this,SLOT(saveAs(void)));
}
Example #14
0
/**
 * Returns the pixmap for the given type as user icon.
 * This is used in worktoolbar to create cursors.
 * @param type   the identification of the icon
 * @return       the wanted cursor
 */
QCursor Cursor(IconType type)
{
    // TODO: generate from a 32x32 cursor template and place requested icon into
    return QCursor(UserIcon(QLatin1String("cursor-") + toString(type)), 9, 9);
}
Example #15
0
ColorPicker::ColorPicker(ToolController &owner)
    : Tool(owner, PICKER, QCursor(QPixmap(":/cursors/colorpicker.png"), 2, 29))
{
}
Example #16
0
void GRolloverButton::hoverMoveEvent( QGraphicsSceneHoverEvent *e )
{
    GLabelItem::hoverMoveEvent( e );
    setCursor( QCursor( Qt::PointingHandCursor ) );
}
Example #17
0
void COverlayDistance::mousePressEvent(QMouseEvent * e)
{
    if(thePoint == 0) return;
    IMap& map   = CMapDB::self().getMap();

    if(e->button() == Qt::LeftButton)
    {
        if(doMove)
        {
            if(*thePoint == points.last() && addType == eAtEnd)
            {
                const int size = subline.size();
                if(size < 2)
                {
                    pt_t pt;
                    pt.u    = e->pos().x();
                    pt.v    = e->pos().y();
                    map.convertPt2Rad(pt.u, pt.v);

                    points.push_back(pt);
                }
                else
                {
                    pt_t pt;
                    pt.u = subline[1].x();
                    pt.v = subline[1].y();
                    map.convertPt2Rad(pt.u, pt.v);

                    *thePoint = pt;

                    for(int i = 2; i < size; i++)
                    {
                        pt.u = subline[i].x();
                        pt.v = subline[i].y();
                        map.convertPt2Rad(pt.u, pt.v);

                        points.push_back(pt);
                    }

                    points.push_back(pt);

                }
                thePointBefor   = &(*(points.end() - 2));
                thePoint        = &points.last();
                thePointAfter   = 0;
            }
            else if(*thePoint == points.first() && addType == eAtEnd)
            {
                const int size = subline.size();
                if(size < 2)
                {

                    pt_t pt;
                    pt.u = e->pos().x();
                    pt.v = e->pos().y();
                    map.convertPt2Rad(pt.u, pt.v);

                    points.push_front(pt);
                }
                else
                {
                    pt_t pt;
                    pt.u = subline[1].x();
                    pt.v = subline[1].y();
                    map.convertPt2Rad(pt.u, pt.v);

                    *thePoint = pt;

                    for(int i = 2; i < size; i++)
                    {
                        pt.u = subline[i].x();
                        pt.v = subline[i].y();
                        map.convertPt2Rad(pt.u, pt.v);

                        points.push_front(pt);
                    }

                    points.push_front(pt);
                }
                thePointBefor   = 0;
                thePoint        = &points.first();
                thePointAfter   = &(*(points.begin() + 1));
            }
            else if(addType != eNone)
            {
                pt_t pt;
                const int size = subline.size();
                int idx = points.indexOf(*thePoint);

                if(size > 2)
                {
                    if(addType == eAfter)
                    {
                        pt.u = subline[0].x();
                        pt.v = subline[0].y();
                        map.convertPt2Rad(pt.u, pt.v);

                        points[idx - 1] = pt;

                        pt.u = subline[size - 1].x();
                        pt.v = subline[size - 1].y();
                        map.convertPt2Rad(pt.u, pt.v);

                        points[idx] = pt;

                        for(int i = 1; i < size - 1; i++)
                        {
                            pt.u = subline[i].x();
                            pt.v = subline[i].y();
                            map.convertPt2Rad(pt.u, pt.v);

                            points.insert(idx - 1 + i,pt);
                        }
                        idx += size - 2;
                    }
                    else
                    {
                        pt.u = subline[0].x();
                        pt.v = subline[0].y();
                        map.convertPt2Rad(pt.u, pt.v);

                        points[idx + 1] = pt;

                        pt.u = subline[size - 1].x();
                        pt.v = subline[size - 1].y();
                        map.convertPt2Rad(pt.u, pt.v);

                        points[idx] = pt;

                        for(int i = 1; i < size - 1; i++)
                        {
                            pt.u = subline[i].x();
                            pt.v = subline[i].y();
                            map.convertPt2Rad(pt.u, pt.v);

                            points.insert(idx+1,pt);
                        }
                    }
                }

                if(addType == eAfter)
                {
                    idx++;
                }

                pt.u = e->pos().x();
                pt.v = e->pos().y();
                map.convertPt2Rad(pt.u, pt.v);
                points.insert(idx,pt);

                thePointBefor   = idx ? &points[idx - 1] : 0;
                thePoint        = &points[idx];
                thePointAfter   = (idx + 1) == points.count() ? 0 : &points[idx + 1];
            }
            else
            {
                pt_t pt;
                pt.u = e->pos().x();
                pt.v = e->pos().y();
                map.convertPt2Rad(pt.u, pt.v);

                *thePoint = pt;

                doMove          = false;
                addType         = eNone;
                thePoint        = 0;
                thePointBefor   = 0;
                thePointAfter   = 0;

            }

            subline.clear();

            calcDistance();
            theMainWindow->getCanvas()->update();

            //if(addType == eNone)   // why?
            //{
            emit sigChanged();
            //}
            return;
        }

        if(!doFuncWheel)
        {
            selectedPoints.clear();
            selectedPoints << points.indexOf(*thePoint);
            emit sigSelectionChanged();

            doFuncWheel = true;
            theMainWindow->getCanvas()->update();
            return;
        }

        QPoint pos1 = e->pos();

        projXY pt = *thePoint;
        map.convertRad2Pt(pt.u, pt.v);
        pos1 -= QPoint(pt.u - 24, pt.v - 24);

        if(rectDel.contains(pos1))
        {
            int idx = points.indexOf(*thePoint);

            if(idx == -1) return;

            points.takeAt(idx);

            if(points.isEmpty())
            {
                QStringList keys(getKey());
                COverlayDB::self().delOverlays(keys);
            }
            calcDistance();
            doFuncWheel     = false;
            thePoint        = 0;
            thePointBefor   = 0;
            thePointAfter   = 0;

            emit sigChanged();
        }
        else if(rectMove.contains(pos1))
        {
            QApplication::setOverrideCursor(QCursor(QPixmap(":/cursors/cursorMoveWpt.png"),0,0));
            doMove      = true;
            doFuncWheel = false;

            savePoint = *thePoint;
        }
        else if(rectAdd1.contains(pos1))
        {
            int idx = points.indexOf(*thePoint);

            if(idx == -1) return;

            pt_t pt;
            pt.u = e->pos().x();
            pt.v = e->pos().y();
            map.convertPt2Rad(pt.u, pt.v);
            points.insert(idx,pt);

            thePointBefor   = idx ? &points[idx - 1] : 0;
            thePoint        = &points[idx];
            thePointAfter   = (idx + 1) == points.count() ? 0 : &points[idx + 1];

            doMove          = true;
            addType         = eBefore;
            doFuncWheel     = false;

            theMainWindow->getCanvas()->update();
        }
        else if(rectAdd2.contains(pos1))
        {
            int idx = points.indexOf(*thePoint);

            if(idx == -1) return;

            idx++;

            pt_t pt;
            pt.u = e->pos().x();
            pt.v = e->pos().y();
            map.convertPt2Rad(pt.u, pt.v);
            points.insert(idx,pt);

            thePointBefor   = idx ? &points[idx - 1] : 0;
            thePoint        = &points[idx];
            thePointAfter   = (idx + 1) == points.count() ? 0 : &points[idx + 1];

            doMove          = true;
            addType         = eAfter;
            doFuncWheel     = false;

            theMainWindow->getCanvas()->update();

        }
        else
        {
            doFuncWheel     = false;
            thePoint        = 0;
            thePointBefor   = 0;
            thePointAfter   = 0;

        }
    }
    else if(e->button() == Qt::RightButton)
    {
        looseFocus();
        return;
    }

    selectedPoints.clear();
    if(addType == eNone)
    {
        emit sigSelectionChanged();
    }
}
Example #18
0
Ui::VideoPanelHeader::VideoPanelHeader(QWidget* _parent, int _items)
    : MoveablePanel(_parent)
    , itemsToShow_(_items)
    , callName_(nullptr)
    , callTime_(nullptr)
    , btnMin_(nullptr)
    , btnClose_(nullptr)
    , lowWidget_(nullptr)
    , secureCallEnabled_(false)
{
#ifdef __linux__
    setStyleSheet(Utils::LoadStyle(":/qss/video_panel_linux"));
#else
    setStyleSheet(Utils::LoadStyle(":/qss/video_panel"));
#endif
    setProperty("VideoPanelHeader", true);
    setContentsMargins(0, 0, 0, 0);

    QHBoxLayout* layout = Utils::emptyHLayout();
    lowWidget_ = new QFrame(this);
    { // low widget. it makes background panel coloured
        lowWidget_->setContentsMargins(DEFAULT_BORDER, 0, 0, 0);
#ifdef __APPLE__
        lowWidget_->setProperty("VideoPanelHeaderMac", true);
#else
        lowWidget_->setProperty("VideoPanelHeader", true);
#endif

        lowWidget_->setLayout(layout);

        QVBoxLayout* vLayoutParent = Utils::emptyVLayout();
        vLayoutParent->setAlignment(Qt::AlignVCenter);
        vLayoutParent->addWidget(lowWidget_);
        setLayout(vLayoutParent);

        layout->setAlignment(Qt::AlignVCenter);

        //layout->addSpacing(DEFAULT_BORDER);
    }

    auto addWidget = [] (QWidget* _parent)
    {
        QWidget* w = new QWidget(_parent);
        w->setContentsMargins(0, 0, 0, 0);
        w->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
        return w;
    };

    auto addLayout = [] (QWidget* _w, Qt::Alignment _align)
    {
        assert(_w);
        if (_w)
        {
            QHBoxLayout* layout = Utils::emptyHLayout();
            layout->setAlignment(_align);
            _w->setLayout(layout);
        }
    };

    QWidget* leftWidg    = addWidget(lowWidget_);
    QWidget* centerWidg  = addWidget(lowWidget_);
    QWidget* rightWidg   = addWidget(lowWidget_);

    layout->addWidget(leftWidg, 1);
    layout->addWidget(centerWidg);
    layout->addWidget(rightWidg, 1);

    addLayout(leftWidg,   Qt::AlignLeft | Qt::AlignVCenter);
    addLayout(centerWidg, Qt::AlignCenter);
    addLayout(rightWidg,  Qt::AlignRight | Qt::AlignVCenter);

    QFont font = QApplication::font();
    font.setStyleStrategy(QFont::PreferAntialias);
    if (itemsToShow_ & kVPH_ShowName)
    {
        callName_ = new NameWidget(leftWidg, Utils::scale_value(18));
        callName_->setFont(font);
        callName_->layout()->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
        callName_->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding));
        callName_->setNameProperty("VideoPanelHeaderText", true);

        leftWidg->layout()->addWidget(callName_);
    }

    if (itemsToShow_ & kVPH_ShowTime)
    {
        callTime_ = new voipTools::BoundBox<PushButton_t>(centerWidg);
        callTime_->setPostfixColor(CommonStyle::getColor(CommonStyle::Color::TEXT_PRIMARY));
        callTime_->setFont(font);
        callTime_->setEnabled(false);
        callTime_->setAlignment(Qt::AlignCenter);
        callTime_->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding));
        callTime_->setFixedWidth(SECURE_BTN_TEXT_W);
        callTime_->setIconSize(SECURE_BTN_ICON_W, SECURE_BTN_ICON_H);

        QObject::connect(callTime_, SIGNAL(clicked()), this, SLOT(_onSecureCallClicked()), Qt::QueuedConnection);
        Utils::ApplyStyle(callTime_, secureCallButton);
        centerWidg->layout()->addWidget(callTime_);
    }

    QWidget* parentWidget = rightWidg;
    auto addButton = [this, parentWidget] (const QString& _propertyName, const char* _slot)->QPushButton*
    {
        QPushButton* btn = new voipTools::BoundBox<QPushButton>(parentWidget);

        Utils::ApplyStyle(btn, _propertyName);
        btn->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding));
        btn->setCursor(QCursor(Qt::PointingHandCursor));
        btn->setFlat(true);
        parentWidget->layout()->addWidget(btn);
        connect(btn, SIGNAL(clicked()), this, _slot, Qt::QueuedConnection);
        return btn;
    };
    if (itemsToShow_ & kVPH_ShowMin)
    {
        btnMin_ = addButton(CommonStyle::getMinimizeButtonStyle(), SLOT(_onMinimize()));
    }

    if (itemsToShow_ & kVPH_ShowClose)
    {
        btnClose_ = addButton(CommonStyle::getCloseButtonStyle(), SLOT(_onClose()));
    }
}
void QtPvdbConceptItem::hoverMoveEvent(QGraphicsSceneHoverEvent *)
{
  this->setCursor(QCursor(Qt::PointingHandCursor));
}
Example #20
0
// =====================================================================
// DUMP alle Tabellen oder eine einzelne Tabelle
// ---------------------------------------------
void admin::dbDump()
{
    if(SavePathEdit->text().count() == 0) {       // ist ein Path gewaehlt ?
      QMessageBox::information( this,
        tr("INFO"),
        tr("\nBitte DUMP-Ordner waehlen !!"),
        QMessageBox::Ok);
      return;
    }
        QString pathToMysql="";
#ifdef Q_WS_WIN
    pathToMysql=settings.value("mySQLPath","").toString();
#endif
    if(checkBoxDb->isChecked() == TRUE ) {     // gesetzt - Alle Tabellen Dumpen
        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
        s = pathToMysql+"mysqldump -u"+settings.value("dbuser").toString()+" -p";
        s += settings.value("dbpasswd").toString();
        s += " --opt "+settings.value("dbname").toString()+" > "+SavePathEdit->text()+"backup-db.sql"; 
        StartProcess(s.toAscii());
        QApplication::restoreOverrideCursor();
    }
    else {                                   // LOG_tabelle dumpen
       QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
       if(lItem) {
         s = pathToMysql+"mysqldump -u"+settings.value("dbuser").toString()+" -p"+settings.value("dbpasswd").toString()+" --opt "+settings.value("dbname").toString()+" ";
          s += lItem->text(0)+" ";          // fun
          s += lItem->text(0)+"qsl ";       // fun_qsl
          s += lItem->text(0)+"om ";        // fun_om
          s += lItem->text(0)+"awd ";       // fun_awd
          s += lItem->text(0)+"card ";      // fun_qslcard
          s += lItem->text(0)+"dx ";        // fun_dx
          s += "wawdlist > ";               
          s+= SavePathEdit->text()+"backup-"+lItem->text(0)+".sql";
          StartProcess(s.toAscii());         // DUMP
	  
          QString tag, monat, jahr, dform;
          QDate d = QDate::currentDate();   // Datum von heute
          tag = s.setNum(d.day());
          monat = s.setNum(d.month());
          jahr = s.setNum(d.year());
	  
          if(tag.count() < 2) tag = "0"+tag;
          if(monat.count() < 2) monat = "0"+monat;
	  
          // Datum_Datensicherung
          qy = "UPDATE dblogs SET saved='"+jahr+"-"+monat+"-"+tag;
          qy += "' WHERE logname='"+lItem->text(0)+"'";
          QSqlQuery query;
          query.exec(qy);
          s = jahr+"-"+monat+"-"+tag;
          lItem->setText(3,s);
       }
       else
         if(sItem) {                          // System_tabelle dumpen
            s = pathToMysql + "mysqldump -u"+settings.value("dbuser").toString()+" -p"+settings.value("dbpasswd").toString()+" --opt "+settings.value("dbname").toString();
            s += " "+sItem->text(0)+" > ";
            s+= SavePathEdit->text()+"backup-"+sItem->text(0)+".sql";
            StartProcess(s.toAscii());        // DUMP
         }
       else {
          QApplication::restoreOverrideCursor();
          QMessageBox::information( this,
          tr("INFO"),
          tr("\nErst eine Tabelle im Logbook- oder QtLog-Ordner waehlen"),
          QMessageBox::Ok);
          return;
       }
    }
    
    s = "cp "+QDir::homePath();             // sichere immer auch qtlog.ini
    s += "/.config/QtLog/qtlog.ini "+SavePathEdit->text();
    StartProcess(s.toAscii());
    
    QApplication::restoreOverrideCursor();
}
Example #21
0
//////////////////////////////////////////////////////////////////////
// Called when mouse moves and does different things depending
//on the state of the mouse buttons for dragging the demod bar or
// filter edges.
//////////////////////////////////////////////////////////////////////
void CPlotter::mouseMoveEvent(QMouseEvent* event)
{

    QPoint pt = event->pos();

    /* mouse enter / mouse leave events */
    if (m_OverlayPixmap.rect().contains(pt))
    {	//is in Overlay bitmap region
        if (event->buttons() == Qt::NoButton)
        {
            bool onTag=false;
            if(pt.y()<15*3) //FIXME
            {
                for(int i=0; i<m_BookmarkTags.size() && !onTag; i++)
                {
                    if(m_BookmarkTags[i].first.contains(event->pos()))
                        onTag=true;
                }
            }
            //if no mouse button monitor grab regions and change cursor icon
            if(onTag)
            {
                setCursor(QCursor(Qt::PointingHandCursor));
                m_CursorCaptured=BOOKMARK;
            }
            else if (isPointCloseTo(pt.x(), m_DemodFreqX, m_CursorCaptureDelta))
            {	//in move demod box center frequency region
                if (CENTER != m_CursorCaptured)
                    setCursor(QCursor(Qt::SizeHorCursor));
                m_CursorCaptured = CENTER;
                if (m_TooltipsEnabled)
                    QToolTip::showText(event->globalPos(),
                                       QString("Demod: %1 kHz")
                                       .arg(m_DemodCenterFreq/1.e3f, 0, 'f', 3),
                                       this, rect());
            }
            else if (isPointCloseTo(pt.x(), m_DemodHiCutFreqX, m_CursorCaptureDelta))
            {	//in move demod hicut region
                if (RIGHT != m_CursorCaptured)
                    setCursor(QCursor(Qt::SizeFDiagCursor));
                m_CursorCaptured = RIGHT;
                if (m_TooltipsEnabled)
                    QToolTip::showText(event->globalPos(),
                                       QString("High cut: %1 Hz")
                                       .arg(m_DemodHiCutFreq),
                                       this, rect());
            }
            else if (isPointCloseTo(pt.x(), m_DemodLowCutFreqX, m_CursorCaptureDelta))
            {	//in move demod lowcut region
                if (LEFT != m_CursorCaptured)
                    setCursor(QCursor(Qt::SizeBDiagCursor));
                m_CursorCaptured = LEFT;
                if (m_TooltipsEnabled)
                    QToolTip::showText(event->globalPos(),
                                       QString("Low cut: %1 Hz")
                                       .arg(m_DemodLowCutFreq),
                                       this, rect());
            }
            else if (isPointCloseTo(pt.x(), m_YAxisWidth/2, m_YAxisWidth/2))
            {
                if (YAXIS != m_CursorCaptured)
                    setCursor(QCursor(Qt::OpenHandCursor));
                m_CursorCaptured = YAXIS;
                if (m_TooltipsEnabled)
                    QToolTip::hideText();
            }
            else if (isPointCloseTo(pt.y(), m_XAxisYCenter, m_CursorCaptureDelta+5))
            {
                if (XAXIS != m_CursorCaptured)
                    setCursor(QCursor(Qt::OpenHandCursor));
                m_CursorCaptured = XAXIS;
                if (m_TooltipsEnabled)
                    QToolTip::hideText();
            }
            else
            {	//if not near any grab boundaries
                if (NONE != m_CursorCaptured)
                {
                    setCursor(QCursor(Qt::ArrowCursor));
                    m_CursorCaptured = NONE;
                }
                if (m_TooltipsEnabled)
                    QToolTip::showText(event->globalPos(),
                                       QString("F: %1 kHz")
                                       .arg(freqFromX(pt.x())/1.e3f, 0, 'f', 3),
                                       this, rect());
            }
            m_GrabPosition = 0;
        }
    }
    else
    {	//not in Overlay region
        if (event->buttons() == Qt::NoButton)
        {
            if (NONE != m_CursorCaptured)
                setCursor(QCursor(Qt::ArrowCursor));

            m_CursorCaptured = NONE;
            m_GrabPosition = 0;
        }
        if (m_TooltipsEnabled)
            QToolTip::showText(event->globalPos(),
                               QString("F: %1 kHz")
                               .arg(freqFromX(pt.x())/1.e3f, 0, 'f', 3),
                               this, rect());
    }
    // process mouse moves while in cursor capture modes
    if (YAXIS == m_CursorCaptured)
    {
        if (event->buttons() & Qt::LeftButton)
        {
            setCursor(QCursor(Qt::ClosedHandCursor));
            // move Y scale up/down
            float delta_px = m_Yzero - pt.y();
            float delta_db = delta_px * fabs(m_MindB-m_MaxdB)/(float)m_OverlayPixmap.height();
            m_MindB -= delta_db;
            m_MaxdB -= delta_db;

            if (m_Running)
                m_DrawOverlay = true;
            else
                drawOverlay();

            m_PeakHoldValid = false;

            m_Yzero = pt.y();
        }
    }
    else if (XAXIS == m_CursorCaptured)
    {
        if (event->buttons() & (Qt::LeftButton | Qt::MidButton))
        {
            setCursor(QCursor(Qt::ClosedHandCursor));
            // pan viewable range or move center frequency
            int delta_px = m_Xzero - pt.x();
            qint64 delta_hz = delta_px * m_Span / m_OverlayPixmap.width();
            if (event->buttons() & Qt::MidButton)
            {
                m_CenterFreq += delta_hz;
                m_DemodCenterFreq += delta_hz;
                emit newCenterFreq(m_CenterFreq);
            }
            else
            {
                setFftCenterFreq(m_FftCenter + delta_hz);
            }
            if (m_Running)
                m_DrawOverlay = true;
            else
                drawOverlay();

            m_PeakHoldValid = false;

            m_Xzero = pt.x();
        }
    }
    else if (LEFT == m_CursorCaptured)
    {   // moving in demod lowcut region
        if (event->buttons() & (Qt::LeftButton|Qt::RightButton))
        {   //moving in demod lowcut region with left button held
            if (m_GrabPosition != 0)
            {
                m_DemodLowCutFreq = freqFromX(pt.x()-m_GrabPosition ) - m_DemodCenterFreq;
                m_DemodLowCutFreq = roundFreq(m_DemodLowCutFreq, m_FilterClickResolution);

                if (m_symetric && (event->buttons() & Qt::LeftButton))  // symetric adjustment
                {
                    m_DemodHiCutFreq = -m_DemodLowCutFreq;
                }
                clampDemodParameters();

                emit newFilterFreq(m_DemodLowCutFreq, m_DemodHiCutFreq);
                if (m_Running)
                    m_DrawOverlay = true;  // schedule update of overlay during draw()
                else
                    drawOverlay();  // not running so update overlay now
            }
            else
            {	//save initial grab postion from m_DemodFreqX
                m_GrabPosition = pt.x()-m_DemodLowCutFreqX;
            }
        }
        else if (event->buttons() & ~Qt::NoButton)
        {
            setCursor(QCursor(Qt::ArrowCursor));
            m_CursorCaptured = NONE;
        }
    }
    else if (RIGHT == m_CursorCaptured)
    {   // moving in demod highcut region
        if (event->buttons() & (Qt::LeftButton|Qt::RightButton))
        {   // moving in demod highcut region with right button held
            if (m_GrabPosition != 0)
            {
                m_DemodHiCutFreq = freqFromX( pt.x()-m_GrabPosition ) - m_DemodCenterFreq;
                m_DemodHiCutFreq = roundFreq(m_DemodHiCutFreq, m_FilterClickResolution);

                if (m_symetric && (event->buttons() & Qt::LeftButton)) // symetric adjustment
                {
                    m_DemodLowCutFreq = -m_DemodHiCutFreq;
                }
                clampDemodParameters();

                emit newFilterFreq(m_DemodLowCutFreq, m_DemodHiCutFreq);
                if (m_Running)
                    m_DrawOverlay = true;  // schedule update of overlay during draw()
                else
                    drawOverlay();  // not running so update oiverlay now
            }
            else
            {	//save initial grab postion from m_DemodFreqX
                m_GrabPosition = pt.x()-m_DemodHiCutFreqX;
            }
        }
        else if (event->buttons() & ~Qt::NoButton)
        {
            setCursor(QCursor(Qt::ArrowCursor));
            m_CursorCaptured = NONE;
        }
    }
    else if (CENTER == m_CursorCaptured)
    {   // moving inbetween demod lowcut and highcut region
        if (event->buttons() & Qt::LeftButton)
        {   // moving inbetween demod lowcut and highcut region with left button held
            if (m_GrabPosition != 0)
            {
                m_DemodCenterFreq = roundFreq(freqFromX(pt.x()-m_GrabPosition), m_ClickResolution );
                emit newDemodFreq(m_DemodCenterFreq, m_DemodCenterFreq-m_CenterFreq);

                if (m_Running)
                    m_DrawOverlay = true;  // schedule update of overlay during draw()
                else
                    drawOverlay();  // not running so update oiverlay now

                m_PeakHoldValid = false;
            }
            else
            {	//save initial grab postion from m_DemodFreqX
                m_GrabPosition = pt.x()-m_DemodFreqX;
            }
        }
        else if (event->buttons() & ~Qt::NoButton)
        {
            setCursor(QCursor(Qt::ArrowCursor));
            m_CursorCaptured = NONE;
        }
    }
    else	//if cursor not captured
    {
        m_GrabPosition = 0;
    }
    if (!this->rect().contains(pt))
    {
        if(NONE != m_CursorCaptured)
            setCursor(QCursor(Qt::ArrowCursor));
        m_CursorCaptured = NONE;
    }
}
Example #22
0
// ======================================================================
// RESTORE database kompl. oder eine einzelne Tabelle
// --------------------------------------------------------
void admin::dbRestore()
{
  int i;
  QString p;
  QFile file;
     i = 0;
     QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
     QString pathToMysql="";
#ifdef Q_WS_WIN
    pathToMysql=settings.value("mySQLPath","").toString();
#endif
     if(checkBoxDb->isChecked() == TRUE ) {          // gesetzt, RESTORE alle Tabellen
        p += SavePathEdit->text()+"backup-db.sql";
        if(!file.exists(p)) {
           QApplication::restoreOverrideCursor();
           QMessageBox::information( this,
           tr("INFO"),
           tr("\nRESTORE nicht moeglich - Datei nicht vorhanden !"),
           QMessageBox::Ok);
          return;
        }
        QSqlQuery query;
        // hier müsste noch pathToMysql rein ! ?
        qy = "DROP DATABASE IF EXISTS "+settings.value("dbname").toString(); 
        query.exec(qy);
         // auch hier müsste noch pathToMysql rein ! ?
        qy = "CREATE DATABASE logdb";                                        
        query.exec(qy);
        qy = "USE logdb";
        query.exec(qy);
 
        // Windows: dbuser hinzugefuegt, sollte unter Linux auch gehen
        s = pathToMysql + "mysql -u"+settings.value("dbuser").toString()+" -p"+settings.value("dbpasswd").toString();
        s += " "+ settings.value("dbname").toString()+" < ";
        s += p;
        StartProcess(s.toAscii());
        i = 1;
     }
     else {                                              // RESTORE eine log_Tabelle
        if( lItem) {
          p = SavePathEdit->text()+"backup-"+lItem->text(0)+".sql";
          if(!file.exists(p)) {
             QApplication::restoreOverrideCursor();
             QMessageBox::information( this,
             tr("INFO"),
             tr("\nRESTORE nicht moeglich - Datei nicht vorhanden !"),
             QMessageBox::Ok);
            return;
          }
         // fun, funqsl, funom, funawd, funcard, fundx, wawdlist
          s = pathToMysql + "mysql -u"+settings.value("dbuser").toString()+" -p"+settings.value("dbpasswd").toString()+" "+settings.value("dbname").toString()+" < ";
          s+= p;
          StartProcess(s.toAscii());
          QSqlQuery query;
          qy = "SELECT COUNT(*) FROM "+lItem->text(0);
          query.exec(qy);
          query.next();
          s = query.value(0).toString();
          qy = "UPDATE dblogs SET qsocnt='"+s+"' WHERE logname='"+lItem->text(0)+"'";
          query.exec(qy);
          i = 0;
       }
       else
          if( sItem ) {                                  // eine system_tabelle 
             p = SavePathEdit->text()+"backup-"+sItem->text(0)+".sql";
             if(!file.exists(p)) {
                QApplication::restoreOverrideCursor();
                QMessageBox::information( this,
                tr("INFO"),
                tr("\nRESTORE nicht moeglich - Datei nicht vorhanden !"),
                QMessageBox::Ok);
               return;
             }
             s = pathToMysql + "mysql -u"+settings.value("dbuser").toString()+" -p"+settings.value("dbpasswd").toString()+" "+settings.value("dbname").toString()+" < ";
             s += p;
             StartProcess(s.toAscii());
             i = 0;
          }
        else {
          QApplication::restoreOverrideCursor();
          QMessageBox::information( this,
          tr("INFO"),
          tr("\nErst eine Tabelle im Logbook- oder QtLog-Ordner waehlen"),
          QMessageBox::Ok);
          return;
       }
     }
     logList->clear();
     sysList->clear();
     showTables(i);                               // Ergebnis in logList und sysList anzeigen.
     QApplication::restoreOverrideCursor();
}
Example #23
0
 Splitter( BrowserBar *w ) : QWidget( w, "divider" )
 {
     setCursor( QCursor(SplitHCursor) );
     styleChange( style() );
 }
Example #24
0
QCursor ExampleView::cursor() const
      {
      return QCursor();
      }
ColorEditor::ColorEditor(QWidget *parent) :
    QFrame(parent),
    d(new ColorEditorImpl(this))
{
    setFocusPolicy(Qt::StrongFocus);
    setFrameShape(QFrame::StyledPanel);
    setCursor(QCursor(Qt::ArrowCursor));

    // Build UI
    // Close button
    auto closeBtn = new QToolButton(this);
    closeBtn->setFixedSize(24, 24);
    closeBtn->setIcon(QIcon(QLatin1String(Core::Constants::ICON_BUTTON_CLOSE)));

    connect(closeBtn, &QToolButton::clicked,
            this, &ColorEditor::close);

    // Color format selection
    d->rgbBtn->setText(QLatin1String("rgb"));
    d->hsvBtn->setText(QLatin1String("hsv"));
    d->hslBtn->setText(QLatin1String("hsl"));
    d->qmlRgbaBtn->setText(QLatin1String("Qt.rgba"));
    d->qmlHslaBtn->setText(QLatin1String("Qt.hsla"));
    d->vecBtn->setText(QLatin1String("vec"));
    d->hexBtn->setText(QLatin1String("hex"));

    d->rgbBtn->setCheckable(true);
    d->hsvBtn->setCheckable(true);
    d->hslBtn->setCheckable(true);
    d->qmlRgbaBtn->setCheckable(true);
    d->qmlHslaBtn->setCheckable(true);
    d->vecBtn->setCheckable(true);
    d->hexBtn->setCheckable(true);

    // Build layouts
    d->formatsLayout->setSpacing(0);

    d->colorFrame->setMinimumSize(QSize(30, 35));

    auto rightLayout = new QVBoxLayout;
    rightLayout->addWidget(d->colorFrame);
    rightLayout->addStretch();

    auto leftPanelLayout = new QVBoxLayout;
    leftPanelLayout->addWidget(closeBtn);
    leftPanelLayout->addStretch();

    auto *colorWidgetsLayout = new QHBoxLayout;
    colorWidgetsLayout->addWidget(d->colorPicker);
    colorWidgetsLayout->addWidget(d->hueSlider);
    colorWidgetsLayout->addWidget(d->saturationSlider);
    colorWidgetsLayout->addWidget(d->valueSlider);
    colorWidgetsLayout->addWidget(d->opacitySlider);
    colorWidgetsLayout->addLayout(rightLayout);

    auto *centerLayout = new QVBoxLayout;
    centerLayout->addLayout(colorWidgetsLayout);
    centerLayout->addLayout(d->formatsLayout);

    auto *mainLayout = new QHBoxLayout(this);
    mainLayout->addLayout(leftPanelLayout);
    mainLayout->addSpacing(0);
    mainLayout->addLayout(centerLayout);

    // Color format selection logic
    d->btnGroup->addButton(d->rgbBtn);
    d->btnGroup->addButton(d->hsvBtn);
    d->btnGroup->addButton(d->hslBtn);
    d->btnGroup->addButton(d->qmlRgbaBtn);
    d->btnGroup->addButton(d->qmlHslaBtn);
    d->btnGroup->addButton(d->vecBtn);
    d->btnGroup->addButton(d->hexBtn);

    connect(d->btnGroup, static_cast<void (QButtonGroup::*)(QAbstractButton *)>(&QButtonGroup::buttonClicked),
            [=] (QAbstractButton *btn) {
        ColorFormat format;

        if (btn == d->rgbBtn) {
            format = ColorFormat::QCssRgbUCharFormat;
        }
        else if (btn == d->hsvBtn) {
            format = ColorFormat::QssHsvFormat;
        }
        else if (btn == d->hslBtn) {
            format = ColorFormat::CssHslFormat;
        }
        else if (btn == d->qmlRgbaBtn) {
            format = ColorFormat::QmlRgbaFormat;
        }
        else if (btn == d->qmlHslaBtn) {
            format = ColorFormat::QmlHslaFormat;
        }
        else if (btn == d->vecBtn) {
            format = ColorFormat::GlslFormat;
        }
        else if (btn == d->hexBtn)
            format = ColorFormat::HexFormat;

        d->setCurrentFormat(format);
    });

    // Color changes logic
    connect(d->colorPicker, &ColorPickerWidget::colorChanged,
            [=](const QColor &pureColor) {
        QColor newColor(pureColor);
        newColor.setAlpha(d->opacitySlider->value());

        d->updateColorWidgets(newColor, ColorEditorImpl::UpdateFromColorPicker);
        d->setCurrentColor(newColor);
    });

    connect(d->hueSlider, &HueSlider::valueChanged,
            [=](int hue) {
        QColor newColor = QColor::fromHsv(hue,
                                          d->color.hsvSaturation(),
                                          d->color.value(),
                                          d->opacitySlider->value());

        d->updateColorWidgets(newColor,
                              ColorEditorImpl::UpdateFromHueSlider);
        d->setCurrentColor(newColor);
    });

    connect(d->saturationSlider, &SaturationSlider::valueChanged,
            [=](int sat) {
        QColor newColor = QColor::fromHsv(d->color.hsvHue(),
                                          sat,
                                          d->color.value(),
                                          d->opacitySlider->value());

        d->updateColorWidgets(newColor,
                              ColorEditorImpl::UpdateFromSaturationSlider);
        d->setCurrentColor(newColor);
    });

    connect(d->valueSlider, &ValueSlider::valueChanged,
            [=](int val) {
        QColor newColor = QColor::fromHsv(d->color.hsvHue(),
                                          d->color.hsvSaturation(),
                                          val,
                                          d->opacitySlider->value());

        d->updateColorWidgets(newColor,
                              ColorEditorImpl::UpdateFromValueSlider);
        d->setCurrentColor(newColor);
    });


    connect(d->opacitySlider, &OpacitySlider::valueChanged,
            [=](int opacity) {
        QColor newColor = QColor::fromHsv(d->hueSlider->value(),
                                          d->color.hsvSaturation(),
                                          d->color.value(),
                                          opacity);

        d->updateColorWidgets(newColor,
                              ColorEditorImpl::UpdateFromOpacitySlider);
        d->setCurrentColor(newColor);
    });

    setColorCategory(ColorCategory::AnyCategory);
    setOutputFormat(ColorFormat::QCssRgbUCharFormat);
    setColor(Qt::red);
}
Example #26
0
/**
 * Set mouse pointer shape
 */
void
mch_set_mouse_shape(int shape)
{
	vimshell->setCursor(QCursor(mshape_ids[shape]));
}
Example #27
0
void K3b::VideoDVDRippingView::reloadMedium()
{
    //
    // For VideoDVD reading it is important that the DVD is not mounted
    //
    if( K3b::isMounted( device() ) && !K3b::unmount( device() ) ) {
        KMessageBox::error( this,
                            i18n("K3b was unable to unmount device '%1' containing medium '%2'. "
                                 "Video DVD ripping will not work if the device is mounted. "
                                 "Please unmount manually.",
                            device()->blockDeviceName(),
                            k3bcore->mediaCache()->medium( device() ).shortString() ),
                            i18n("Unmounting failed") );
    }

    //
    // K3b::VideoDVD::open does not necessarily fail on encrypted DVDs if dvdcss is not
    // available. Thus, we test the availability of libdvdcss here
    //
    if( device()->copyrightProtectionSystemType() == K3b::Device::COPYRIGHT_PROTECTION_CSS ) {
        K3b::LibDvdCss* css = K3b::LibDvdCss::create();
        if( !css ) {
            KMessageBox::error( this, i18n("<p>Unable to read Video DVD contents: Found encrypted Video DVD."
                                           "<p>Install <i>libdvdcss</i> to get Video DVD decryption support.") );
            return;
        }
        else
            delete css;
    }

    QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) );

    if( d->dvd.open( device() ) ) {
        setTitle( i18n( "%1 (Video DVD)", medium().beautifiedVolumeId() ) );
        d->labelLength->setText( i18np("%1 title", "%1 titles", d->dvd.numTitles() ) );
        d->model->setVideoDVD( d->dvd );
        QApplication::restoreOverrideCursor();

        bool transcodeUsable = true;

        if( !k3bcore ->externalBinManager() ->foundBin( "transcode" ) ) {
            KMessageBox::sorry( this,
                                i18n("K3b uses transcode to rip Video DVDs. "
                                     "Please make sure it is installed.") );
            transcodeUsable = false;
        }
        else {
            int vc = 0, ac = 0;
            for( int i = 0; i < K3b::VideoDVDTitleTranscodingJob::VIDEO_CODEC_NUM_ENTRIES; ++i )
                if( K3b::VideoDVDTitleTranscodingJob::transcodeBinaryHasSupportFor( (K3b::VideoDVDTitleTranscodingJob::VideoCodec)i ) )
                    ++vc;
            for( int i = 0; i < K3b::VideoDVDTitleTranscodingJob::AUDIO_CODEC_NUM_ENTRIES; ++i )
                if( K3b::VideoDVDTitleTranscodingJob::transcodeBinaryHasSupportFor( (K3b::VideoDVDTitleTranscodingJob::AudioCodec)i ) )
                    ++ac;
            if( !ac || !vc ) {
                KMessageBox::sorry( this,
                                    i18n("<p>K3b uses transcode to rip Video DVDs. "
                                         "Your installation of transcode lacks support for any of the "
                                         "codecs supported by K3b."
                                         "<p>Please make sure it is installed properly.") );
                transcodeUsable = false;
            }
        }

        actionCollection()->action("start_rip")->setEnabled( transcodeUsable );
    }
    else {
        QApplication::restoreOverrideCursor();

        KMessageBox::error( this, i18n("Unable to read Video DVD contents.") );
    }
}
void QAutoGenDialog::accept()
{
	unsigned int i, iVehicles = m_txtVehicles->value(), iCar;
	QString strParam, strValue, strName, strType = m_comboVehicleType->currentText();
	std::map<QString, QString> mapParams;
	std::map<QString, std::map<QString, AutoGenParameter> >::iterator iterParams = m_mapModels.find(strType), iterAssocParams;
	std::map<QString, AutoGenParameter>::iterator iterParam;
	QStringList listDepends;
	QStringList::iterator iterDepend;
	in_addr_t ipAddress, ipTemp;
	std::map<QString, QString> mapAssocModels;
	std::map<QString, QString>::iterator iterAssocModel;
	std::map<QString, QString> mapAssocModelTypes;
	std::map<QString, QString>::iterator iterAssocModelType;
	std::vector<std::pair<QString, QString> > vecAssocModelTypes;
	std::map<QString, std::map<QString, AutoGenParameter> > mapAssocModelParams;
	std::map<QString, std::map<QString, ModelParameter> >::iterator iterModelType = m_pMapParams->find(strType), iterModelParams;
	std::map<QString, ModelParameter>::iterator iterModelParam;
	std::set<QString> setDepends;
	std::set<QString>::iterator iterSetDepend;
	QAutoGenModelDialog * pDialog;
	int nResult;
	bool bAddressSet = false;
	std::map<QString, Rect>::iterator iterAddressParams;

	// get record list for different parameters
	for (iterAddressParams = m_mapMapSelections.begin(); iterAddressParams != m_mapMapSelections.end(); ++iterAddressParams)
	{
		switch (m_comboRegionType->currentItem())
		{
		case 0:
			g_pMapDB->GetRecordsInRegion(m_mapRandomRecords[iterAddressParams->first], iterAddressParams->second);
			break;
		default:
			break;
		}
	}

	// make list of associated models
	for (iterParam = iterParams->second.begin(); iterParam != iterParams->second.end(); ++iterParam)
	{
		strParam = iterParam->first, strValue = iterParam->second.strValue;
		iterModelParam = iterModelType->second.find(strParam);
		if (iterParam->second.eType == AutoGenParamTypeNewModel)
		{
			vecAssocModelTypes.push_back(std::pair<QString, QString>(strParam, strValue));
			mapAssocModelTypes.insert(vecAssocModelTypes.back());
		}
	}

	for (i = 0; i < vecAssocModelTypes.size(); i++)
	{
		if (vecAssocModelTypes[i].second.compare(NULLMODEL_NAME) != 0)
		{
			pDialog = new QAutoGenModelDialog(vecAssocModelTypes[i].first, vecAssocModelTypes[i].second, this);
			m_mapModelIndexes[vecAssocModelTypes[i].second] = 0;
			iterModelParams = m_pMapParams->find(vecAssocModelTypes[i].second);
			iterAssocParams = m_mapModels.find(vecAssocModelTypes[i].second);
			iterAssocParams = mapAssocModelParams.insert(std::pair<QString, std::map<QString, AutoGenParameter> >(vecAssocModelTypes[i].first, iterAssocParams->second)).first;
			pDialog->m_pVecModelTypes = m_pVecModelTypes;
			pDialog->m_pAssocModelTypeMap = &mapAssocModelTypes;
			pDialog->m_pAssocModelTypes = &vecAssocModelTypes;
			pDialog->m_pModelParams = &iterModelParams->second;
			// generate auto-generator parameters
			pDialog->m_pParams = &iterAssocParams->second;
			pDialog->InitializeModelParams();
			nResult = pDialog->exec();
			delete pDialog;
			if (nResult == QDialog::Rejected)
				return;
		}
	}

	iCar = 0;
	qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
	ipAddress = GetIPAddress();
	for (i = 0; i < iVehicles; i++)
	{
		// create this vehicle
		while (m_pModelNames->find(strName = QString("%1%2").arg(strType).arg(iCar)) != m_pModelNames->end())
			iCar++;
		for (iterParam = iterParams->second.begin(); iterParam != iterParams->second.end(); ++iterParam)
		{
			strParam = iterParam->first, strValue = iterParam->second.strValue;
			iterModelParam = iterModelType->second.find(strParam);
			switch (iterParam->second.eType & (~AutoGenParamTypeNoRandom))
			{
			case AutoGenParamTypeNewModel:
				iterAssocModelType = mapAssocModelTypes.find(strParam);
				setDepends.insert(mapParams[iterAssocModelType->first] = GetAssocModel(iterAssocModelType->first, iterAssocModelType->second, mapAssocModels, mapAssocModelTypes, mapAssocModelParams, i));
				break;
			case AutoGenParamTypeDepends:
				listDepends = QStringList::split(';', strValue);
				for (iterDepend = listDepends.begin(); iterDepend != listDepends.end(); ++iterDepend)
					setDepends.insert(*iterDepend);
				break;
			case AutoGenParamTypeIP:
				if (!bAddressSet && StringToIPAddress(strValue, ipTemp))
					ipAddress = ipTemp;
				break;
			case AutoGenParamTypeRandom:
				mapParams[strParam] = GetRandomParameter(strParam, strValue, iterModelParam->second);
				break;
			case AutoGenParamTypeFile:
				mapParams[strParam] = GetFileParameter(strParam, strValue, i);
				break;
			default:
				mapParams[strParam] = strValue;
				break;
			}
		}
		while (m_pVehicleIPs->find(ipAddress) != m_pVehicleIPs->end())
			ipAddress++;
		bAddressSet = true;
		mapParams[m_strIPAddressParam] = IPAddressToString(ipAddress);
		setDepends.erase("NULL");
		mapParams[PARAM_DEPENDS] = QString::null;
		for (iterSetDepend = setDepends.begin(); iterSetDepend != setDepends.end(); ++iterSetDepend)
		{
			if (mapParams[PARAM_DEPENDS].isEmpty())
				mapParams[PARAM_DEPENDS] = *iterSetDepend;
			else
				mapParams[PARAM_DEPENDS] += (';' + *iterSetDepend);
		}
		setDepends.clear();
		m_pVehicleIPs->insert(ipAddress);
		m_pModels->insert(std::pair<QString, std::map<QString, QString> >(strName, mapParams));
		m_pVehicleList->push_back(std::pair<QString, QString>(strName, strType));
		m_pModelNames->insert(strName);
		mapAssocModels.clear();
		iCar++;
		ipAddress++;
	}

	m_mapFileData.clear();
	qApp->restoreOverrideCursor();
	QDialog::accept();
}
void KItemListHeaderWidget::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
{
    QGraphicsWidget::mouseMoveEvent(event);

    switch (m_roleOperation) {
    case NoRoleOperation:
        if ((event->pos() - m_pressedMousePos).manhattanLength() >= QApplication::startDragDistance()) {
            // A role gets dragged by the user. Create a pixmap of the role that will get
            // synchronized on each furter mouse-move-event with the mouse-position.
            m_roleOperation = MoveRoleOperation;
            const int roleIndex = roleIndexAt(m_pressedMousePos);
            m_movingRole.index = roleIndex;
            if (roleIndex == 0) {
                // TODO: It should be configurable whether moving the first role is allowed.
                // In the context of Dolphin this is not required, however this should be
                // changed if KItemViews are used in a more generic way.
                QApplication::setOverrideCursor(QCursor(Qt::ForbiddenCursor));
            } else {
                m_movingRole.pixmap = createRolePixmap(roleIndex);

                qreal roleX = -m_offset;
                for (int i = 0; i < roleIndex; ++i) {
                    const QByteArray role = m_columns[i];
                    roleX += m_columnWidths.value(role);
                }

                m_movingRole.xDec = event->pos().x() - roleX;
                m_movingRole.x = roleX;
                update();
            }
        }
        break;

    case ResizeRoleOperation: {
        const QByteArray pressedRole = m_columns[m_pressedRoleIndex];

        qreal previousWidth = m_columnWidths.value(pressedRole);
        qreal currentWidth = previousWidth;
        currentWidth += event->pos().x() - event->lastPos().x();
        currentWidth = qMax(minimumColumnWidth(), currentWidth);

        m_columnWidths.insert(pressedRole, currentWidth);
        update();

        emit columnWidthChanged(pressedRole, currentWidth, previousWidth);
        break;
    }

    case MoveRoleOperation: {
        // TODO: It should be configurable whether moving the first role is allowed.
        // In the context of Dolphin this is not required, however this should be
        // changed if KItemViews are used in a more generic way.
        if (m_movingRole.index > 0) {
            m_movingRole.x = event->pos().x() - m_movingRole.xDec;
            update();

            const int targetIndex = targetOfMovingRole();
            if (targetIndex > 0 && targetIndex != m_movingRole.index) {
                const QByteArray role = m_columns[m_movingRole.index];
                const int previousIndex = m_movingRole.index;
                m_movingRole.index = targetIndex;
                emit columnMoved(role, targetIndex, previousIndex);

                m_movingRole.xDec = event->pos().x() - roleXPosition(role);
            }
        }
        break;
    }

    default:
        break;
    }
}
Example #30
-1
UBRubberBand::enm_resizingMode UBRubberBand::determineResizingMode(QPoint pos)
{
    if (mMouseIsPressed)
        return mResizingMode;
    
    QRect resizerTop    (mResizingBorderHeight               , 0                             , rect().width()-2*mResizingBorderHeight, mResizingBorderHeight                    );
    QRect resizerBottom (mResizingBorderHeight               , rect().height() - mResizingBorderHeight, rect().width()-2*mResizingBorderHeight, mResizingBorderHeight                    );
    QRect resizerLeft   (0                          , mResizingBorderHeight                  , mResizingBorderHeight                 , rect().height() - 2*mResizingBorderHeight);
    QRect resizerRight  (rect().width()-mResizingBorderHeight, mResizingBorderHeight                  , mResizingBorderHeight                 , rect().height() - 2*mResizingBorderHeight);

    QRect resizerTopLeft    (0                          , 0                             , mResizingBorderHeight, mResizingBorderHeight);
    QRect resizerTopRight   (rect().width()-mResizingBorderHeight, 0                             , mResizingBorderHeight, mResizingBorderHeight);
    QRect resizerBottomLeft (0                          , rect().height() - mResizingBorderHeight, mResizingBorderHeight, mResizingBorderHeight);
    QRect resizerBottomRight(rect().width()-mResizingBorderHeight, rect().height() - mResizingBorderHeight, mResizingBorderHeight, mResizingBorderHeight);

    enm_resizingMode resizingMode;
    
    QTransform cursorTransrofm;

    if (resizerTop.contains(pos))
    {
        resizingMode = Top;
        cursorTransrofm.rotate(90);
    }
    else
    if (resizerBottom.contains(pos))
    {
        resizingMode = Bottom;
        cursorTransrofm.rotate(90);
    }
    else
    if (resizerLeft.contains(pos))
    {
        resizingMode = Left;
    }
    else
    if (resizerRight.contains(pos))
    {
        resizingMode = Right;
    }
    else
    if (resizerTopLeft.contains(pos))
    {
        resizingMode = TopLeft;
        cursorTransrofm.rotate(45);
    }
    else
    if (resizerTopRight.contains(pos))
    {
        resizingMode = TopRight;
        cursorTransrofm.rotate(-45);
    }
    else
    if (resizerBottomLeft.contains(pos))
    {
        resizingMode = BottomLeft;
        cursorTransrofm.rotate(-45);
    }
    else
    if (resizerBottomRight.contains(pos))
    {
        resizingMode = BottomRight;
        cursorTransrofm.rotate(45);
    }
    else
        resizingMode = None;
    
    if (None != resizingMode)
    {
        QPixmap pix(":/images/cursors/resize.png");
        QCursor resizeCursor  = QCursor(pix.transformed(cursorTransrofm, Qt::SmoothTransformation), pix.width() / 2,  pix.height() / 2);
        setCursor(resizeCursor);
    }
    else
        unsetCursor();

    return resizingMode;
}