Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. mousepressevent
    Log in to post

    • SOLVED Question about QGraphicsScene and QGraphicsPixmapItem
      General and Desktop • qgraphicsscene mousepressevent qgraphicspixmap mousemoveevent • • CAP 33  

      10
      0
      Votes
      10
      Posts
      179
      Views

      I solved my problem via event filter of scene. ui->graphicsView->scene()->installEventFilter(this); bool MainWindow::eventFilter(QObject* obj, QEvent* event){ if(event->type() == QEvent::GraphicsSceneMousePress){ if(ui->addServerBtn->isChecked()){ QGraphicsSceneMouseEvent* mouseSceneEvent; mouseSceneEvent = static_cast<QGraphicsSceneMouseEvent *>(event); Server *serv = new Server(mouseSceneEvent->scenePos().toPoint()); scene->addItem((QGraphicsPixmapItem*)serv); } } return false; }
    • SOLVED [SOLVED] mousePressEvent in QtQuickView
      QML and Qt Quick • event qwindow mousepressevent qquickwindow qquickview • • madoodia  

      13
      0
      Votes
      13
      Posts
      411
      Views

      The problem is solved please check this https://forum.qt.io/topic/113640/solved-why-q-window-events-are-eaten-by-qml-item thanks
    • UNSOLVED QMessageBox closes application
      General and Desktop • connect mousepressevent qpolygon • • hobbyProgrammer  

      35
      0
      Votes
      35
      Posts
      1338
      Views

      @hobbyProgrammer said in window closes after completing certain actions.: @JonB Hi, just a quick update. I think it does get there, but it prints this part before going executing the slot. It's really important for those who try to help you to give accurate description of what does/does not happen. Everyone was trying to figure how your connect() could not complete and get to the next line....
    • UNSOLVED add a QToolbar as a child of a QGraphicsItem
      General and Desktop • qgraphicsitem qtoolbar mousepressevent maptoscene • • sayan275  

      2
      0
      Votes
      2
      Posts
      362
      Views

      Hi, What about QGraphicsProxyWidget ?
    • SOLVED Click on drop-down list of QComboBox
      General and Desktop • combobox mousepressevent • • Maluna34  

      9
      0
      Votes
      9
      Posts
      5832
      Views

      @raven-worx It works !!! Thank you !!! Now I just have to see if I can check it into the scene (maybe create a widgetitem for the viewport, I'll see.
    • UNSOLVED Checking for letters pressed when mouse is pressed
      General and Desktop • keypressevent mousepressevent • • LancelotPops  

      6
      0
      Votes
      6
      Posts
      3493
      Views

      Hi and welcome to devnet, Can you explain why do you need to know whether a letter is currently pressed ? A long press on such a key usually triggers the auto-repeat of the system so it might make things a bit more difficult.
    • SOLVED QPushButton, Overwrite and StyleSheet
      General and Desktop • qpushbutton qstylesheet mousepressevent • • J.Hilk  

      5
      0
      Votes
      5
      Posts
      3374
      Views

      @Chris-Kawa turns out, you were spot on! I had some difficulties to compile my "fix" in release configuration. So I went and rewrote the class, with your comment in mind. I intoduced a new signal and changed the overrides accordingly. void signalEvent(QMouseEvent::Type t, QPoint p); now, I don't need the timer, it also works in debug as well as in release mode... virtual void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE{ emit signalEvent(QMouseEvent::MouseButtonPress, e->pos()); QPushButton::mousePressEvent(e); } works like a charm. Thanks!
    • UNSOLVED MouseArea with forwarded events does not receive release event
      QML and Qt Quick • mousearea mouse event mousepressevent event handling • • hvoigt  

      4
      0
      Votes
      4
      Posts
      1462
      Views

      @JLimbocker Tried your code but unfortunately it does not exactly what I want. It is selecting from the beginning instead of from where I was clicking when dragging. Problem with passing the mouse event through to the TextField is that when I do that using mouse.accepted = false. The other handler like onRelease: are not called on the MouseArea anymore which destroys my handling there. The selectAll() could be switched off when something is already selected but I do not know why that TextField's selection is starting from the beginning... Anyone knows how to forward the mouse events to an underlying element but still have the complete handling in the MouseArea available? That would solve my question.
    • UNSOLVED How to get mouse press event on a QPixmap
      General and Desktop • qpixmap mousepressevent qgraphicspixmap • • EarthHobbit  

      2
      0
      Votes
      2
      Posts
      3157
      Views

      @EarthHobbit Hi This sample works for me (i can click it ) #include <QApplication> #include<QGraphicsScene> #include<QGraphicsDropShadowEffect> #include<QGraphicsPixmapItem> #include<QMessageBox> #include<QGraphicsView> class myGraphicsPixmapItem: public QGraphicsPixmapItem { public: myGraphicsPixmapItem(QPixmap pixmap): QGraphicsPixmapItem(pixmap) { }; ~myGraphicsPixmapItem() { }; void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) { QMessageBox::information(NULL, "Information!", "Mouse release Detected!"); }; }; int main(int argc, char* argv[]) { QApplication app(argc, argv); QGraphicsScene scene; QPixmap pix(200, 200); QPainter* paint = new QPainter(&pix); paint->setPen(QColor(255, 34, 255, 255)); paint->drawRect(0, 0, 200, 200); myGraphicsPixmapItem* pixmapItem = new myGraphicsPixmapItem(pix); pixmapItem->setFlags(QGraphicsItem::ItemIsMovable); delete paint; QGraphicsView view(&scene); scene.addItem(pixmapItem); view.showFullScreen(); return app.exec(); }
    • SOLVED Can I make the QCheckBox label clickable?
      General and Desktop • qcheckbox mousepressevent • • Jakob  

      3
      0
      Votes
      3
      Posts
      1391
      Views

      Nevermind - in the end it turned out the label was modeled as a separate QLabel instead of the text of the QCheckBox. Once I removed the label, and put the text inside the checkbox, I got exactly what I was asking for.
    • Weird behaviour of QLineEdit
      Mobile and Embedded • qlineedit keypressevent mousepressevent • • Sidii  

      1
      0
      Votes
      1
      Posts
      460
      Views

      No one has replied