Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-33741

QWidget::setCursor for QCursor created from QPixmap with mask does not work second time

    XMLWordPrintable

Details

    Description

      This is similar than QTBUG-31504 but happens when you have two cursors with masked bitmaps. I Can't reproduce issue with QTBUG-31504 example so not duplicate.

      Qt 5.0.0 changes cursor but Qt 5.1.1 doesn't.

      class MyWidget : public QWidget
      {
          Q_OBJECT
      public:
          MyWidget(QWidget * w=0) : QWidget(w) {
              c1 = new QCursor(
                      QPixmap(QLatin1String(":/cursor1.png"),"png",Qt::MonoOnly),
                      QPixmap(QLatin1String(":/mask.png"),"png",Qt::MonoOnly),
                      0,0);
              c2 = new QCursor(
                      QPixmap(QLatin1String(":/cursor2.png"),"png",Qt::MonoOnly),
                      QPixmap(QLatin1String(":/mask.png"),"png",Qt::MonoOnly),
                      0,0);
              current = c1;
              setCursor(*current);
          }
      
          void mousePressEvent(QMouseEvent*)
          {
              if(current != c1)
                  current = c1;
              else
                  current = c2;
              setCursor(*current);
          }
      
      private:
          QCursor* c1;
          QCursor* c2;
          QCursor* current;
      };
      

      full application: cursorpixmap.zip

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              peppe Giuseppe D'Angelo
              qtcomsupport Qt Support
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes