void B9Projector::resizeEvent ( QResizeEvent * pEvent ) { pEvent->accept(); QImage newImage(width(),height(),QImage::Format_ARGB32_Premultiplied); QPainter painter(&newImage); painter.drawImage(QPoint(0,0), mImage); mImage = newImage; createNormalizedMask(); drawAll(); QDesktopWidget dt; emit newGeometry (dt.screenNumber(), geometry()); }
void WebPopupMenuImpl::resize(const WebSize& newSize) { if (m_size == newSize) return; m_size = newSize; if (m_widget) { IntRect newGeometry(0, 0, m_size.width, m_size.height); m_widget->setFrameRect(newGeometry); } if (m_client) { WebRect damagedRect(0, 0, m_size.width, m_size.height); m_client->didInvalidateRect(damagedRect); } }
bool Compositor::xcbEvent(const xcb_configure_notify_event_t *e) { if (e->window == root_) { QRect newGeometry(0, 0, e->width, e->height); if (rootGeometry_ != newGeometry) { rootGeometry_ = newGeometry; Q_EMIT rootGeometryChanged(rootGeometry_); } } if (e->window != e->event) { return false; } return xcbDispatchEvent(e); }
void GcOverlayWidget::keyPressEvent(QKeyEvent *e) { if (!m_isEditing) return; if (e->key() == Qt::Key_Delete) { //this->deleteLater(); } if (QApplication::keyboardModifiers() == Qt::ControlModifier) { QPoint newPos(x(),y()); if (e->key() == Qt::Key_Up) newPos.setY(newPos.y()-1); if (e->key() == Qt::Key_Down) newPos.setY(newPos.y()+1); if (e->key() == Qt::Key_Left) newPos.setX(newPos.x()-1); if (e->key() == Qt::Key_Right) newPos.setX(newPos.x()+1); move(newPos); } if (QApplication::keyboardModifiers() == Qt::ShiftModifier) { if (e->key() == Qt::Key_Up) resize(width(),height()-1); if (e->key() == Qt::Key_Down) resize(width(),height()+1); if (e->key() == Qt::Key_Left) resize(width()-1,height()); if (e->key() == Qt::Key_Right) resize(width()+1,height()); } emit newGeometry(geometry()); }
TContainerLine::TContainerLine(QWidget *parent, QPoint p, QWidget *cWidget) : RptContainer(parent,p,cWidget) { QString stl = "TContainerLine#lbl {;" "border-width:1px;" "border-style:solid;" "border-color:rgba(0,0,0,255);" "border-top-color:rgba(0,0,0,255);" "border-left-color:rgba(0,0,0,255);" "border-right-color:rgba(0,0,0,255);" "border-bottom-color:rgba(0,0,0,255);" "color:rgba(0,0,0,255);" "background-color:rgba(255,255,255,0);" "}"; cs = 0; ce = 0; m_arrowStart = false; m_arrowEnd = true; this->setStyleSheet(stl); this->resize(10,10); this->setBaseSize(width(),height()); this->allowResize(false); this->allowDrawSelection(false); this->setAutoFillBackground(true); this->move(-50,-50); line.setP1( QPoint() ); line.setP2( QPoint() ); QPalette Pal(palette()); Pal.setColor(QPalette::Background, Qt::blue); cs = new XYZContainer(parent,QPoint(line.p1().x(), line.p2().y())); cs->setObjectName("CS"); cs->resize(6,6); cs->allowResize(false); cs->allowDrawSelection(false); cs->setVisible(false); cs->setAutoFillBackground(true); cs->setPalette(Pal); ce = new XYZContainer(parent,QPoint(line.p2().x(), line.p2().y())); ce->setObjectName("CE"); ce->resize(6,6); ce->allowResize(false); ce->allowDrawSelection(false); ce->setVisible(false); ce->setAutoFillBackground(true); ce->setPalette(Pal); QObject::connect(cs, SIGNAL(newGeometry(QRect, QRect)), this, SIGNAL(newGeometry(QRect, QRect))); QObject::connect(ce, SIGNAL(newGeometry(QRect, QRect)), this, SIGNAL(newGeometry(QRect, QRect))); QObject::connect(ce, SIGNAL(newGeometry(QRect, QRect)), this, SLOT(lineChanged(QRect, QRect))); QObject::connect(cs, SIGNAL(newGeometry(QRect, QRect)), this, SLOT(lineChanged(QRect, QRect))); //QObject::connect(cs, SIGNAL(geomChanged(QRect, QRect)), this, SIGNAL(geomChanged(QRect, QRect))); //QObject::connect(ce, SIGNAL(geomChanged(QRect, QRect)), this, SIGNAL(geomChanged(QRect, QRect))); QObject::connect(cs, SIGNAL(geomChanged(QRect, QRect)), this, SLOT(geomContChanged(QRect, QRect))); QObject::connect(ce, SIGNAL(geomChanged(QRect, QRect)), this, SLOT(geomContChanged(QRect, QRect))); QObject::connect(cs, SIGNAL(destroyed()), this, SLOT(delItemInTree())); QObject::connect(ce, SIGNAL(destroyed()), this, SLOT(delItemInTree())); QObject::connect(this, SIGNAL(delCont(QTreeWidgetItem *)), this, SLOT(delItemInTree())); QObject::connect(cs, SIGNAL(inFocus(bool)), this, SLOT(m_inFocus(bool))); QObject::connect(ce, SIGNAL(inFocus(bool)), this, SLOT(m_inFocus(bool))); //QObject::connect(this, SIGNAL(inFocus(bool)), cs, SIGNAL(inFocus(bool))); //QObject::connect(this, SIGNAL(inFocus(bool)), ce, SIGNAL(inFocus(bool))); this->show(); }
void GcOverlayWidget::mouseMoveEvent(QMouseEvent *e) { QWidget::mouseMoveEvent(e); if (!m_isEditing) return; if (!m_infocus) return; if (!e->buttons() & Qt::LeftButton) { QPoint p = QPoint(e->x()+geometry().x(), e->y()+geometry().y()); setCursorShape(p); return; } if ((mode == moving || mode == none) && e->buttons() && Qt::LeftButton) { QPoint toMove = e->globalPos() - position; if (toMove.x() < 0) return; if (toMove.y() < 0) return; if (toMove.x() > parentWidget()->width()-width()) return; move(toMove); emit newGeometry(geometry()); parentWidget()->repaint(); return; } if ((mode != moving) && e->buttons() && Qt::LeftButton) { switch (mode){ case resizetl: { //Left-Top int newwidth = e->globalX() - position.x() - geometry().x(); int newheight = e->globalY() - position.y() - geometry().y(); QPoint toMove = e->globalPos() - position; resize(geometry().width()-newwidth,geometry().height()-newheight); move(toMove.x(),toMove.y()); break; } case resizetr: { //Right-Top int newheight = e->globalY() - position.y() - geometry().y(); QPoint toMove = e->globalPos() - position; resize(e->x(),geometry().height()-newheight); move(x(),toMove.y()); break; } case resizebl: { //Left-Bottom int newwidth = e->globalX() - position.x() - geometry().x(); QPoint toMove = e->globalPos() - position; resize(geometry().width()-newwidth,e->y()); move(toMove.x(),y()); break; } case resizeb: { //Bottom resize(width(),e->y()); break;} case resizel: { //Left int newwidth = e->globalX() - position.x() - geometry().x(); QPoint toMove = e->globalPos() - position; resize(geometry().width()-newwidth,height()); move(toMove.x(),y()); break; } case resizet: { //Top int newheight = e->globalY() - position.y() - geometry().y(); QPoint toMove = e->globalPos() - position; resize(width(),geometry().height()-newheight); move(x(),toMove.y()); break; } case resizer: { //Right resize(e->x(),height()); break;} case resizebr: { //Right-Bottom resize(e->x(),e->y()); break;} } parentWidget()->repaint(); } emit newGeometry(geometry()); //QWidget::mouseMoveEvent(e); }