Example #1
0
void Layout::breakLayout()
{
    WidgetFactory::deleteLayout( layoutBase );
    bool needReparent = qstrcmp( layoutBase->className(), "QLayoutWidget" ) == 0 ||
			( !WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( layoutBase ) ) ) &&
			  layoutBase != formWindow->mainContainer() );
    bool add = geometries.isEmpty();
    for ( QWidget *w = widgets.first(); w; w = widgets.next() ) {
	if ( needReparent )
	    w->reparent( layoutBase->parentWidget(), 0,
			 layoutBase->pos() + w->pos(), TRUE );
	if ( add )
	    geometries.insert( w, QRect( w->pos(), w->size() ) );
    }
    if ( needReparent ) {
	layoutBase->hide();
	parent = layoutBase->parentWidget();
    } else {
	parent = layoutBase;
    }
    if ( widgets.first() && widgets.first()->isVisibleTo( formWindow ) )
	formWindow->selectWidget( widgets.first() );
    else
	formWindow->selectWidget( formWindow );
}
Example #2
0
void UXInfoPlugin::processEvent(QObject *obj, QEvent *e)
{
	QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent*>(e);
	QWidget *widget = dynamic_cast<QWidget*>(obj);
	QPoint pos;
	if (mouseEvent && widget && mouseEvent->type() == QMouseEvent::MouseButtonPress) {
		pos = widget->pos();
		for (; widget; widget = dynamic_cast<QWidget*>(widget->parent())) {
			pos += widget->pos();
		}

		UXInfo::reportMouseClick(mouseEvent->pos() + pos);
	}
}
Example #3
0
void LXQtGroupPopup::dropEvent(QDropEvent *event)
{
    qlonglong temp;
    QDataStream stream(event->mimeData()->data(LXQtTaskButton::mimeDataFormat()));
    stream >> temp;
    WId window = (WId) temp;

    LXQtTaskButton *button = nullptr;
    int oldIndex(0);
    // get current position of the button being dragged
    for (int i = 0; i < layout()->count(); i++)
    {
        LXQtTaskButton *b = qobject_cast<LXQtTaskButton*>(layout()->itemAt(i)->widget());
        if (b && b->windowId() == window)
        {
            button = b;
            oldIndex = i;
            break;
        }
    }

    if (button == nullptr)
        return;

    int newIndex = -1;
    // find the new position to place it in
    for (int i = 0; i < oldIndex && newIndex == -1; i++)
    {
        QWidget *w = layout()->itemAt(i)->widget();
        if (w && w->pos().y() + w->height() / 2 > event->pos().y())
            newIndex = i;
    }
    const int size = layout()->count();
    for (int i = size - 1; i > oldIndex && newIndex == -1; i--)
    {
        QWidget *w = layout()->itemAt(i)->widget();
        if (w && w->pos().y() + w->height() / 2 < event->pos().y())
            newIndex = i;
    }

    if (newIndex == -1 || newIndex == oldIndex)
        return;

    QVBoxLayout * l = qobject_cast<QVBoxLayout *>(layout());
    l->takeAt(oldIndex);
    l->insertWidget(newIndex, button);
    l->invalidate();

}
void	QsvTextOperationsWidget::showBottomWidget(QWidget* w)
{
	if (w == NULL) {
		if (m_replace && m_replace->isVisible())
			w = m_replace;
		else if (m_search && m_search->isVisible())
			w = m_search;
		else if (m_gotoLine && m_gotoLine->isVisible())
			w = m_gotoLine;
	}
	if (!w)
		return;

	QRect r;
	QWidget *parent = qobject_cast<QWidget*>(this->parent());

	// I must admit this line looks ugly, but I am open to suggestions
	if (parent->inherits("QAbstractScrollArea"))
		parent = ((QAbstractScrollArea*) (parent))->viewport();

	r = parent->rect();
	w->adjustSize();
	r.adjust(10, 0, -10, 0);
	r.setHeight(w->height());
	r.moveBottom(parent->rect().height()-10);

	r.moveLeft(parent->pos().x() + 10);
	w->setGeometry(r);
	w->show();
}
Example #5
0
void QSplitter::moveAfter( int pos, int id, bool upLeft )
{
    QSplitterLayoutStruct *s = id < int(data->list.count()) ?
			       data->list.at(id) : 0;
    if ( !s )
	return;
    QWidget *w = s->wid;
    if ( w->isHidden() ) {
	moveAfter( pos, id+1, upLeft );
    } else if ( pick( w->pos() ) == pos ) {
	//No need to do anything if it's already there.
	return;
    } else if ( s->isSplitter ) {
	int dd = s->sizer;
	if ( upLeft ) {
	    setG( w, pos, dd );
	    moveAfter( pos+dd, id+1, upLeft );
	} else {
	    moveAfter( pos+dd, id+1, upLeft );
	    setG( w, pos, dd );
	}
    } else {
	int right = pick( w->geometry().bottomRight() );

       	int dd = right - pos + 1;
	dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize())));
	int newRight = pos+dd-1;
	setG( w, pos, dd );
	moveAfter( newRight+1, id+1, upLeft );
    }
}
Example #6
0
void QSplitter::moveBefore( int pos, int id, bool upLeft )
{
    QSplitterLayoutStruct *s = data->list.at(id);
    if ( !s )
	return;
    QWidget *w = s->wid;
    if ( w->isHidden() ) {
	moveBefore( pos, id-1, upLeft );
    } else if ( s->isSplitter ) {
	int dd = s->sizer;
	if ( upLeft ) {
	    setG( w, pos-dd+1, dd );
	    moveBefore( pos-dd, id-1, upLeft );
	} else {
	    moveBefore( pos-dd, id-1, upLeft );
	    setG( w, pos-dd+1, dd );
	}
    } else {
	int left = pick( w->pos() );
	int dd = pos - left + 1;
	dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize())));
	int newLeft = pos-dd+1;
	setG( w, newLeft, dd );
	if ( left != newLeft )
	    moveBefore( newLeft-1, id-1, upLeft );
    }
}
ZLQtWaitMessage::ZLQtWaitMessage(const std::string &message) : QWidget(0, 0, WStyle_Splash), myLabelText(::qtString(message)) {
	QWidget *main = qApp->mainWidget();
	if (main != 0) {
		myCursorIsStored = true;
		myStoredCursor = main->cursor();
		main->setCursor(Qt::waitCursor);
	} else {
		myCursorIsStored = false;
	}
	setCursor(Qt::waitCursor);

	qApp->processEvents();

	if (main == 0) {
		main = QApplication::desktop();
	}
	QPoint position = main->mapToGlobal(main->pos());
	QFontMetrics metrics = fontMetrics();
	const int w = metrics.width(myLabelText) + 20;
	const int h = metrics.height() + 20;
	resize(1, 1);
	show();
	setGeometry(
		position.x() + (main->width() - w) / 2,
		position.y() + (main->height() - h) / 2,
		w, h
	);

	qApp->processEvents();
	for (int i = 0; i < 6; ++i) {
		usleep(5000);
		qApp->processEvents();
	}
}
Example #8
0
bool AppInit::eventFilter(QObject *obj, QEvent *evt)
{
    QWidget *w = (QWidget *)obj;
    if (!w->property("CanMove").toBool()) {
        return QObject::eventFilter(obj, evt);
    }

    QMouseEvent *event = static_cast<QMouseEvent *>(evt);
    if (event->type() == QEvent::MouseButtonPress) {
        if (event->button() == Qt::LeftButton) {
            mousePressed = true;
            mousePoint = event->globalPos() - w->pos();
            return true;
        }
    } else if (event->type() == QEvent::MouseButtonRelease) {
        mousePressed = false;
        return true;
    } else if (event->type() == QEvent::MouseMove) {
        if (mousePressed && (event->buttons() && Qt::LeftButton)) {
            w->move(event->globalPos() - mousePoint);
            return true;
        }
    }

    return QObject::eventFilter(obj, evt);
}
Example #9
0
void QWidget::updateRequestedRegion( const QPoint &gpos )
{
    if ( !isTopLevel() ) {
	if ( !testWState( WState_Visible ) || testWState(WState_ForceHide) ) {
	    req_region = QRegion();
	} else {
	    req_region = QRect(gpos,crect.size());
	    if ( extra && !extra->mask.isNull() ) {
		QRegion maskr = extra->mask;
		maskr.translate( gpos.x(), gpos.y() );
		req_region &= maskr;
	    }
	    req_region = qt_screen->mapToDevice( req_region, QSize(qt_screen->width(), qt_screen->height()) );
	}
    }
    const QObjectList *c = children();
    if ( c ) {
	QObjectListIt it(*c);
	QObject* ch;
	while ((ch=it.current())) {
	    ++it;
	    if ( ch->isWidgetType() && !((QWidget*)ch)->isTopLevel() ) {
		QWidget *w = (QWidget *)ch;
		w->updateRequestedRegion( gpos + w->pos() );
	    }
	}
    }
}
Example #10
0
void Animator::timerEvent(QTimerEvent *event){
    vX += accelerationX;
    vY += accelerationY;
    for(int i=data.length()-1; i>=0; i--){
        QWidget* w = data.at(i).first;
        QPoint p = w->pos();
        int end = 2;
        if((vX > 0 && p.x() + (int) vX < data.at(i).second.x() )||
           (vX < 0 && p.x() + (int) vX > data.at(i).second.x()))
            p.setX(p.x()+ (int) vX);
        else{
            p.setX(data.at(i).second.x());
            end--;
        }

        if((vY > 0 && p.y() + (int) vY < data.at(i).second.y() )||
           (vY < 0 && p.y() + (int) vY > data.at(i).second.y()))
            p.setY(p.y()+ (int) vY);
        else{
            p.setY(data.at(i).second.y());
            end--;
        }
        w->move(p);
        if(end==0){
            data.removeAt(i);
        }
    }
    if(data.length()==0){
        this->setup();
        emit ended();
    }
}
void tst_QWidget_window::tst_move_show()
{
    QWidget w;
    w.move(100, 100);
    w.show();
    QCOMPARE(w.pos(), QPoint(100, 100));
//    QCoreApplication::processEvents(QEventLoop::AllEvents, 3000);
}
Example #12
0
bool WidgetGraphicsItem::eventFilter( QObject *object, QEvent *e )
{
    if ( !visible() || d->m_widget == 0 ) {
        return false;
    }

    MarbleWidget *widget = dynamic_cast<MarbleWidget*> (object);
    if ( !widget ) {
        return ScreenGraphicsItem::eventFilter(object, e);
    }

    if ( d->m_marbleWidget != widget ) {
        // Delayed initialization
        d->m_marbleWidget = widget;
    }

    Q_ASSERT(d->m_marbleWidget);

    if ( e->type() == QEvent::MouseButtonDblClick
         || e->type() == QEvent::MouseMove
         || e->type() == QEvent::MouseButtonPress
         || e->type() == QEvent::MouseButtonRelease )
    {
        // Mouse events are forwarded to the underlying widget
        QMouseEvent *event = static_cast<QMouseEvent*> ( e );

        QList<QPointF> widgetPositions = absolutePositions();
        QRectF widgetItemRect;
        QPoint shiftedPos;
        QList<QPointF>::iterator it = widgetPositions.begin();
        bool foundRightPosition = false;
        while( it != widgetPositions.end() && !foundRightPosition ) {
            widgetItemRect = QRectF( *it, size() );

            if ( widgetItemRect.contains( event->pos() ) ) {
                foundRightPosition = true;
                shiftedPos = event->pos() - widgetItemRect.topLeft().toPoint();
            }
        }
        
        if ( foundRightPosition ) {
            QWidget *child = d->m_widget->childAt( shiftedPos );
            
            if ( child ) {
                d->m_marbleWidget->setCursor( Qt::ArrowCursor );
                shiftedPos -= child->pos(); // transform to children's coordinates
                QMouseEvent shiftedEvent = QMouseEvent( e->type(), shiftedPos,
                        event->globalPos(), event->button(), event->buttons(),
                        event->modifiers() );
                if ( QApplication::sendEvent( child, &shiftedEvent ) ) {
                    return true;
                }
            }
        }
    }

    return ScreenGraphicsItem::eventFilter(object, e);
}
void QDesignerMimeData::moveDecoration(const QPoint &globalPos) const
{
    const QPoint relativeDistance = globalPos - m_globalStartPos;
    const QDesignerDnDItems::const_iterator cend = m_items.constEnd();
    for (QDesignerDnDItems::const_iterator it =m_items.constBegin(); it != cend; ++it ) {
        QWidget *w = (*it)->decoration();
        w->move(w->pos() + relativeDistance);
    }
}
Example #14
0
void Window::SetPositionRelative(PRectangle rc, Window relativeTo)
{
    QWidget *rel = PWindow(relativeTo.wid);
    QPoint pos = rel->mapToGlobal(rel->pos());

    int x = pos.x() + rc.left;
    int y = pos.y() + rc.top;

    PWindow(wid)->setGeometry(x, y, rc.right - rc.left, rc.bottom - rc.top);
}
Example #15
0
void Container::setContainerGeometry()
{
	
	//copyData(data.barState, CorePlugin::instance()->data.ContainerBar, 7);
	//copyData(data.geometry, CorePlugin::instance()->data.ContainerGeometry, 5);
	if(data.geometry[WIDTH].toLong() == -1 || data.geometry[HEIGHT].toLong() == -1)
	{
		QWidget *desktop = QApplication::desktop();
		data.geometry[WIDTH].asLong() = desktop->width() / 3;
		data.geometry[HEIGHT].asLong() = desktop->height() / 3;
	}
	if(data.geometry[TOP].toLong() != -1 || data.geometry[LEFT].toLong() != -1)
	{
		QWidgetList list = QApplication::topLevelWidgets();
		for(int i = 0; i < 2; i++)
		{
			QWidget *w;
			bool bOK = true;
			foreach(w,list)
			{
				if(w == this)
					continue;
				if(w->inherits("Container"))
				{
					int dw = w->pos().x() - data.geometry[LEFT].toLong();
					int dh = w->pos().y() - data.geometry[TOP].toLong();
					if (dw < 0)
						dw = -dw;
					if (dh < 0)
						dh = -dh;
					if (dw < 3 && dh < 3)
					{
						long nl = data.geometry[LEFT].toLong();
						long nt = data.geometry[TOP].toLong();
						nl += 21;
						nt += 20;
						QWidget *desktop = QApplication::desktop();
						if (nl + data.geometry[WIDTH].toLong() > desktop->width())
							nl = 0;
						if (nt + data.geometry[WIDTH].toLong() > desktop->width())
							nt = 0;
						if (nl != data.geometry[LEFT].toLong() && nt != data.geometry[TOP].toLong())
						{
							data.geometry[LEFT].asLong() = nl;
							data.geometry[TOP].asLong()  = nt;
							bOK = false;
						}
					}
				}
			}
			if (bOK)
				break;
		}
	}
Example #16
0
void ReWidgetSelection::MoveBy( const QPoint& _delta )
{
	TItemListItor itor = Begin();
	TItemListItor itorEnd = End();
	for( ; itor != itorEnd; ++itor )
	{
		ReSelItem& item = *itor;
		QWidget* widget = item.GetWidget();
		widget->move( widget->pos() + _delta );
	}
}
Example #17
0
QPoint PlayerArea::topLeftPoint() const
{
	QPoint topLeftCoordinate = pos();
	QWidget *thisWidget = parentWidget();
	while (thisWidget != window())
	{
		topLeftCoordinate += thisWidget->pos();
		thisWidget = thisWidget->parentWidget();
	}
	return topLeftCoordinate;
}
Example #18
0
void 
Unicorn::TabBar::mouseMoveEvent( QMouseEvent* e )
{
    if( !m_tearable )
        return;
        
    if( !(e->buttons() & Qt::LeftButton) || m_mouseDownPos.isNull() )
        return;
        
    if( (e->pos() - m_mouseDownPos ).manhattanLength() < 
        k_startTearDistance)
        return;
        
    TabWidget* tabWidget = qobject_cast<TabWidget*>( parentWidget() );
    if( !tabWidget )
        return;
        
    int index = currentIndex();
    removeTab( index );

    QWidget* curWidget = tabWidget->widget( index );
    if( !curWidget )
        return;
        
    QPoint offset = curWidget->mapToGlobal(curWidget->pos()) - QCursor::pos();
    curWidget->setParent( window(), Qt::Tool );
    curWidget->move( QCursor::pos() + QPoint(offset.x(), 0));
    curWidget->resize( tabWidget->size());
    curWidget->show();
    m_tearable = false;
    while( QApplication::mouseButtons() & Qt::LeftButton )
    {
        if( curWidget->pos() != QCursor::pos())
            curWidget->move( QCursor::pos() + QPoint(offset.x(), 0));
        QApplication::processEvents( QEventLoop::WaitForMoreEvents );
    }
    curWidget->installEventFilter( this );
    m_tearable = true;
    m_mouseDownPos = QPoint();
}
Example #19
0
void UIMachineViewNormal::normalizeGeometry(bool bAdjustPosition)
{
#ifndef VBOX_GUI_WITH_CUSTOMIZATIONS1
    QWidget *pTopLevelWidget = window();

    /* Make no normalizeGeometry in case we are in manual resize mode or main window is maximized: */
    if (pTopLevelWidget->isMaximized())
        return;

    /* Calculate client window offsets: */
    QRect frameGeo = pTopLevelWidget->frameGeometry();
    QRect geo = pTopLevelWidget->geometry();
    int dl = geo.left() - frameGeo.left();
    int dt = geo.top() - frameGeo.top();
    int dr = frameGeo.right() - geo.right();
    int db = frameGeo.bottom() - geo.bottom();

    /* Get the best size w/o scroll bars: */
    QSize s = pTopLevelWidget->sizeHint();

    /* Resize the frame to fit the contents: */
    s -= pTopLevelWidget->size();
    frameGeo.setRight(frameGeo.right() + s.width());
    frameGeo.setBottom(frameGeo.bottom() + s.height());

    if (bAdjustPosition)
    {
        QRegion availableGeo;
        QDesktopWidget *dwt = QApplication::desktop();
        if (dwt->isVirtualDesktop())
            /* Compose complex available region */
            for (int i = 0; i < dwt->numScreens(); ++ i)
                availableGeo += dwt->availableGeometry(i);
        else
            /* Get just a simple available rectangle */
            availableGeo = dwt->availableGeometry(pTopLevelWidget->pos());

        frameGeo = VBoxGlobal::normalizeGeometry(frameGeo, availableGeo, vboxGlobal().vmRenderMode() != SDLMode /* can resize? */);
    }

#if 0
    /* Center the frame on the desktop: */
    frameGeo.moveCenter(availableGeo.center());
#endif

    /* Finally, set the frame geometry */
    pTopLevelWidget->setGeometry(frameGeo.left() + dl, frameGeo.top() + dt, frameGeo.width() - dl - dr, frameGeo.height() - dt - db);

#else /* !VBOX_GUI_WITH_CUSTOMIZATIONS1 */
    Q_UNUSED(bAdjustPosition);
#endif /* VBOX_GUI_WITH_CUSTOMIZATIONS1 */
}
Example #20
0
void RootController::dismissWidget()
{
	if(!m_dismissable) return;
	QWidget *widget = m_stack.pop();
	QWidget *next = m_stack.size() ? m_stack.top() : 0;
	if(next) next->move(widget->pos());
	
	present(next);
	
	widget->hide();
	if(m_ownership.value(widget)) widget->deleteLater();
	m_ownership.remove(widget);
}
Example #21
0
void RootController::presentWidget(QWidget *widget, bool owns)
{
	for(int i = 0; i < m_stack.size(); ++i) {
		if(m_stack.at(i) == widget) m_stack.remove(i);
	}
	m_ownership[widget] = owns;
	QWidget *prev = m_stack.size() ? m_stack.top() : 0;
	m_stack.push(widget);
	constrain(widget);
	if(prev) widget->move(prev->pos());
	present(widget);
	if(prev) prev->hide();
}
Example #22
0
void QMxWindow::dragPointMove(int x, int y)
{
    QPoint newPoint(x,y);
    if(moveValid){
        QWidget* window = scene()->views().first()->window();
        QPoint delta = newPoint - lastMovePoint;
        window->move(window->pos() + delta);
        newPoint -= delta;
    }else{
        moveValid = true;
    }
    lastMovePoint = newPoint;
}
void SyszuxIM::hideInput()                              //隐藏输入法槽函数
{
    QWidget *currentWidget = new QWidget;
    QWidget *parentWidget = new QWidget;
    currentWidget = QApplication::focusWidget();
    parentWidget = currentWidget->parentWidget();
    if ( 0 != widgetMoveY) {
        parentWidget->move(0,parentWidget->pos().ry() + widgetMoveY);
        widgetMoveY = 0;
    }
    currentWidget->clearFocus();

}
Example #24
0
// -----------------------------------------------------------------------------
// General.
// -----------------------------------------------------------------------------
void ReWidgetSelection::GotoWaitState()
{
	TItemListItor itor = Begin();
	TItemListItor itorEnd = End();
	for( ; itor != itorEnd; ++itor )
	{
		ReSelItem& item = *itor;
		QWidget* widget = item.GetWidget();
		item.GetDragInfoRef().SetItemPosBackup( widget->pos() );
	}

	m_state = EState_Wait;
}
Example #25
0
void MainWindowPlugin::onOptionsClosed()
{
	QWidget *widget = FMainWindowBorder ? (QWidget*)FMainWindowBorder : (QWidget*)FMainWindow;
	Options::node(OPV_MAINWINDOW_SIZE).setValue(widget->size());
	Options::node(OPV_MAINWINDOW_POSITION).setValue(widget->pos());
#ifdef Q_WS_WIN
	if ((QSysInfo::windowsVersion() == QSysInfo::WV_WINDOWS7) && !Options::node(OPV_MAINWINDOW_MINIMIZETOTRAY_W7).value().toBool())
		widget->hide();
	else
#endif
		widget->close();
	FOpenAction->setVisible(false);
	updateTitle();
}
Example #26
0
void AdvancedWidget<BaseClass>::mousePressEvent(QMouseEvent *event)
{
	if (!_border && (event->button() == Qt::LeftButton)) {
		QWidget *window = BaseClass::window();

		_region = getMouseRegion(event->globalPos().x(), event->globalPos().y(), window->geometry());
		if (_region != Qt::NoSection) {
			_action = WinAction::Resizing;
		}
		else {
			_movePath = event->globalPos() - window->pos();
			_action = WinAction::Dragging;
		}
	}

	BaseClass::mousePressEvent(event);
}
Example #27
0
/**
 * Construct a KSystemTray icon to be displayed when new mail
 * has arrived in a non-system folder.  The KMSystemTray listens
 * for updateNewMessageNotification events from each non-system
 * KMFolder and maintains a store of all folders with unread
 * messages.
 *
 * The KMSystemTray also provides a popup menu listing each folder
 * with its count of unread messages, allowing the user to jump
 * to the first unread message in each folder.
 */
KMSystemTray::KMSystemTray(QWidget *parent, const char *name)
  : KSystemTray( parent, name ),
    mParentVisible( true ),
    mPosOfMainWin( 0, 0 ),
    mDesktopOfMainWin( 0 ),
    mMode( GlobalSettings::EnumSystemTrayPolicy::ShowOnUnread ),
    mCount( 0 ),
    mNewMessagePopupId(-1),
    mPopupMenu(0)
{
  setAlignment( AlignCenter );
  kdDebug(5006) << "Initting systray" << endl;

  mLastUpdate = time( 0 );
  mUpdateTimer = new QTimer( this, "systraytimer" );
  connect( mUpdateTimer, SIGNAL( timeout() ), SLOT( updateNewMessages() ) );

  mDefaultIcon = loadIcon( "kmail" );
  mLightIconImage = loadIcon( "kmaillight" ).convertToImage();

  setPixmap(mDefaultIcon);

  KMMainWidget * mainWidget = kmkernel->getKMMainWidget();
  if ( mainWidget ) {
    QWidget * mainWin = mainWidget->topLevelWidget();
    if ( mainWin ) {
      mDesktopOfMainWin = KWin::windowInfo( mainWin->winId(),
                                            NET::WMDesktop ).desktop();
      mPosOfMainWin = mainWin->pos();
    }
  }

  // register the applet with the kernel
  kmkernel->registerSystemTrayApplet( this );

  /** Initiate connections between folders and this object */
  foldersChanged();

  connect( kmkernel->folderMgr(), SIGNAL(changed()), SLOT(foldersChanged()));
  connect( kmkernel->imapFolderMgr(), SIGNAL(changed()), SLOT(foldersChanged()));
  connect( kmkernel->dimapFolderMgr(), SIGNAL(changed()), SLOT(foldersChanged()));
  connect( kmkernel->searchFolderMgr(), SIGNAL(changed()), SLOT(foldersChanged()));

  connect( kmkernel->acctMgr(), SIGNAL( checkedMail( bool, bool, const QMap<QString, int> & ) ),
           SLOT( updateNewMessages() ) );
}
void DesignerEventHandler::onMousePress( QMouseEvent * e )
{
  QWidget * w = checkWidget (e->pos());

//qDebug () << "mouse press: "<<w;

  context_widget = dynamic_cast<VtlWidget*>(w);

  if (dynamic_cast<VtlWidget*>(w)) {
    if (e->state() & Qt::ShiftModifier) {
      if (selected_widgets.indexOf((VtlWidget*)w) == -1) {
        addWidgetToSelection((VtlWidget *)w);
      }
      else if (e->button() == Qt::LeftButton) {
        removeWidgetFromSelection((VtlWidget*)w);
      }
    }
    else if (selected_widgets.isEmpty() || selected_widgets.indexOf((VtlWidget*)w) == -1) {
      clearSelection();
      addWidgetToSelection((VtlWidget*)w);
    }

    if (e->button() & Qt::LeftButton) {
      widgetPressed = true;
      widgetGeom = QRect(w->pos(), w->size());
      cursorPos = e->pos();
      oldCursorPos = cursorPos;
      savedCursorPos = cursorPos;
      oldPositions.clear();
      for (SWPtrList::const_iterator iter = selected_widgets.begin(); iter != selected_widgets.end(); ++iter) {
        oldPositions.append(QVariant((*iter)->pos()));
      }
    }
  }
  else if (dynamic_cast<VtlWindow*>(w)) {
    if (e->state() ^ Qt::ShiftModifier) {
      clearSelection();
    }

    if (e->button() & Qt::LeftButton) {
      beginSelRectangle(e->pos());
      drawSelRect = true;
    }
  }
}
bool ossimQtVceWindowController::saveState(ossimKeywordlist& kwl,
                                           const char* prefix)const
{
   if(theVceWindow)
   {
      kwl.add(prefix,
              ossimKeywordNames::TYPE_KW,
              "ossimQtVceWindow",
              true);
      QWidget* widget = theVceWindow->parentWidget(true);
      QPoint pt(widget->pos());
      
      kwl.add(prefix,
              "position",
              ossimString::toString((int)pt.x()) + " " + ossimString::toString((int)pt.y()),
              true);
      
      kwl.add(prefix,
              "size",
              ossimString::toString((int)theVceWindow->width()) + " " + ossimString::toString((int)theVceWindow->height()),
              true);
      
      ossimString showState = "shown";
      if(theVceWindow->isMinimized())
      {
         showState = "minimized";
      }
      else if(theVceWindow->isMaximized())
      {
         showState = "maximized";
      }
      else if(theVceWindow->isHidden())
      {
         showState = "hidden";
      }
   
   kwl.add(prefix,
           "show_state",
           showState,
           true);
      return theVceWindow->theCanvasView->saveState(kwl, (ossimString(prefix)+"canvas_view0.").c_str());
   }
   
   return false;
}
Example #30
0
void EditFrame::Translate(const QPoint &delta, bool snap)
{
	QWidget *pParent = parentWidget();
	if( pParent )
	{
		QPoint newPos(pParent->pos() + delta);
		if( snap )
		{
			QPoint snappedPos(newPos);
			Utils::Snap(ToyWindowTab::GRID_SPACING, snappedPos);
			if(delta.x() != 0)
				newPos.setX( snappedPos.x() );
			if(delta.y() != 0)
				newPos.setY( snappedPos.y() );
		}
		
		SetPos(newPos);
	}
}