Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. No fill option in QColorDialog
Forum Updated to NodeBB v4.3 + New Features

No fill option in QColorDialog

Scheduled Pinned Locked Moved Unsolved General and Desktop
qcolordialog
20 Posts 3 Posters 6.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Qt Enthusiast
    wrote on last edited by
    #9

    if i have square in QGraphicsView and if I use this no color , the fill color of box should be set to its background just like clearing the box color fill color . Am I clear or shall I send a image for the same

    1 Reply Last reply
    0
    • Q Qt Enthusiast

      When I click on the empty boxes in Custom color . it is changing to white . Am I missing something

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #10

      @Qt-Enthusiast
      Those white colors are custom colors :)
      Its not for no color.

      1 Reply Last reply
      0
      • mrjjM mrjj

        @raven-worx
        No, it means set to no color.
        Like if for painter, then clear the fill color so it dont fill. ( is my guess :)

        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #11

        @mrjj
        and whats the difference between "no fill" and "transparancy" then?!

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        mrjjM 1 Reply Last reply
        1
        • raven-worxR raven-worx

          @mrjj
          and whats the difference between "no fill" and "transparancy" then?!

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #12

          @raven-worx
          You are right,
          its should give same effect ?

          But im not sure user will intuitively think, "ahh
          if i lower Alpha to zero, it get rid of fill" :)

          1 Reply Last reply
          0
          • Q Offline
            Q Offline
            Qt Enthusiast
            wrote on last edited by
            #13

            Can someone write the code

            mrjjM 1 Reply Last reply
            0
            • Q Qt Enthusiast

              Can someone write the code

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #14

              @Qt-Enthusiast
              Hi
              @raven-worx showed you what to add to your color dialog.
              colorDialog->setOption( QColorDialog::ShowAlphaChannel, true );
              Then you get Alpha value.
              User can set to zero and you get a transparent color which should look the same as no color.

              1 Reply Last reply
              0
              • Q Offline
                Q Offline
                Qt Enthusiast
                wrote on last edited by
                #15

                This is my code
                can some one guide me how to do it here

                connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(clickedActivated(const QModelIndex&)));
                }

                void myView::clickedActivated(const QModelIndex& index)
                {
                if (index.column() == 1 ) {
                QColorDialog* colorDialog = new QColorDialog;
                colorDialog->setOption(QColorDialog::ShowAlphaChannel, true );
                QColor color = QColorDialog::getColor();
                d_model->setData(index,color,Qt::DecorationRole);

                }

                as I am getting compiltation error

                raven-worxR 1 Reply Last reply
                0
                • Q Qt Enthusiast

                  This is my code
                  can some one guide me how to do it here

                  connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(clickedActivated(const QModelIndex&)));
                  }

                  void myView::clickedActivated(const QModelIndex& index)
                  {
                  if (index.column() == 1 ) {
                  QColorDialog* colorDialog = new QColorDialog;
                  colorDialog->setOption(QColorDialog::ShowAlphaChannel, true );
                  QColor color = QColorDialog::getColor();
                  d_model->setData(index,color,Qt::DecorationRole);

                  }

                  as I am getting compiltation error

                  raven-worxR Offline
                  raven-worxR Offline
                  raven-worx
                  Moderators
                  wrote on last edited by
                  #16

                  @Qt-Enthusiast

                  QColorDialog colorDialog;
                  colorDialog.setOption(QColorDialog::ShowAlphaChannel, true );
                  colorDialog.exec();
                  QColor color = colorDialog.getColor();
                  if( color.isValid() )
                     d_model->setData(index,color,Qt::DecorationRole);
                  

                  --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                  If you have a question please use the forum so others can benefit from the solution in the future

                  1 Reply Last reply
                  2
                  • Q Offline
                    Q Offline
                    Qt Enthusiast
                    wrote on last edited by
                    #17

                    I am using qt.4.3.3 I am getting following compliation error

                    error: ?class QColorDialog? has no member named ?setOption?
                    colorDialog.setOption(QColorDialog::ShowAlphaChannel, true );
                    error: ?ShowAlphaChannel? is not a member of ?QColorDialog?
                    colorDialog.setOption(QColorDialog::ShowAlphaChannel, true );

                    my code is

                    void myInstView::clickedActivated(const QModelIndex& index)
                    {
                    if (index.column() == 1 ) {
                    QColorDialog colorDialog;
                    colorDialog.setOption(QColorDialog::ShowAlphaChannel, true );
                    colorDialog.exec();
                    QColor color = colorDialog.getColor();
                    if( color.isValid() )
                    model->setData(index,color,Qt::DecorationRole);
                    }

                    }
                    }

                    raven-worxR 1 Reply Last reply
                    0
                    • Q Qt Enthusiast

                      I am using qt.4.3.3 I am getting following compliation error

                      error: ?class QColorDialog? has no member named ?setOption?
                      colorDialog.setOption(QColorDialog::ShowAlphaChannel, true );
                      error: ?ShowAlphaChannel? is not a member of ?QColorDialog?
                      colorDialog.setOption(QColorDialog::ShowAlphaChannel, true );

                      my code is

                      void myInstView::clickedActivated(const QModelIndex& index)
                      {
                      if (index.column() == 1 ) {
                      QColorDialog colorDialog;
                      colorDialog.setOption(QColorDialog::ShowAlphaChannel, true );
                      colorDialog.exec();
                      QColor color = colorDialog.getColor();
                      if( color.isValid() )
                      model->setData(index,color,Qt::DecorationRole);
                      }

                      }
                      }

                      raven-worxR Offline
                      raven-worxR Offline
                      raven-worx
                      Moderators
                      wrote on last edited by
                      #18

                      @Qt-Enthusiast
                      it seems it is only available since Qt 4.5

                      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                      If you have a question please use the forum so others can benefit from the solution in the future

                      1 Reply Last reply
                      2
                      • Q Offline
                        Q Offline
                        Qt Enthusiast
                        wrote on last edited by
                        #19

                        Can there be any alternative to it

                        mrjjM 1 Reply Last reply
                        0
                        • Q Qt Enthusiast

                          Can there be any alternative to it

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #20

                          @Qt-Enthusiast
                          Nope.
                          Fast way is to make new button or menu
                          that clear the color on the selected item.

                          1 Reply Last reply
                          1

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved