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
QtWS25 Last Chance

No fill option in QColorDialog

Scheduled Pinned Locked Moved Unsolved General and Desktop
qcolordialog
20 Posts 3 Posters 5.2k Views
  • 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.
  • R raven-worx
    25 May 2016, 08:05

    @mrjj
    and how is it possible to click on no color?

    M Offline
    M Offline
    mrjj
    Lifetime Qt Champion
    wrote on 25 May 2016, 08:08 last edited by mrjj
    #5

    @raven-worx
    In paint programs its often shown as clear box with cross over.
    with the other colors. And left click clears pen color and right click clear fill color.
    (tried to find image)

    :)
    (edit)
    In power point its a button

    R 1 Reply Last reply 25 May 2016, 08:15
    1
    • Q Offline
      Q Offline
      Qt Enthusiast
      wrote on 25 May 2016, 08:15 last edited by
      #6

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

      M 1 Reply Last reply 25 May 2016, 08:28
      0
      • M mrjj
        25 May 2016, 08:08

        @raven-worx
        In paint programs its often shown as clear box with cross over.
        with the other colors. And left click clears pen color and right click clear fill color.
        (tried to find image)

        :)
        (edit)
        In power point its a button

        R Offline
        R Offline
        raven-worx
        Moderators
        wrote on 25 May 2016, 08:15 last edited by
        #7

        @mrjj
        ok, so meaning transparency?

        This should be somewhat possible with:

        colorDialog->setOption( QColorDialog::ShowAlphaChannel, true );
        

        --- 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

        M 1 Reply Last reply 25 May 2016, 08:19
        1
        • R raven-worx
          25 May 2016, 08:15

          @mrjj
          ok, so meaning transparency?

          This should be somewhat possible with:

          colorDialog->setOption( QColorDialog::ShowAlphaChannel, true );
          
          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 25 May 2016, 08:19 last edited by mrjj
          #8

          @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 :)

          R 1 Reply Last reply 25 May 2016, 08:35
          0
          • Q Offline
            Q Offline
            Qt Enthusiast
            wrote on 25 May 2016, 08:22 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
              25 May 2016, 08:15

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

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 25 May 2016, 08:28 last edited by
              #10

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

              1 Reply Last reply
              0
              • M mrjj
                25 May 2016, 08:19

                @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 :)

                R Offline
                R Offline
                raven-worx
                Moderators
                wrote on 25 May 2016, 08:35 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

                M 1 Reply Last reply 25 May 2016, 08:37
                1
                • R raven-worx
                  25 May 2016, 08:35

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

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 25 May 2016, 08:37 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 25 May 2016, 08:49 last edited by
                    #13

                    Can someone write the code

                    M 1 Reply Last reply 25 May 2016, 08:52
                    0
                    • Q Qt Enthusiast
                      25 May 2016, 08:49

                      Can someone write the code

                      M Offline
                      M Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on 25 May 2016, 08:52 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 25 May 2016, 09:28 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

                        R 1 Reply Last reply 25 May 2016, 09:32
                        0
                        • Q Qt Enthusiast
                          25 May 2016, 09:28

                          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

                          R Offline
                          R Offline
                          raven-worx
                          Moderators
                          wrote on 25 May 2016, 09:32 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 25 May 2016, 09:38 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);
                            }

                            }
                            }

                            R 1 Reply Last reply 25 May 2016, 09:42
                            0
                            • Q Qt Enthusiast
                              25 May 2016, 09:38

                              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);
                              }

                              }
                              }

                              R Offline
                              R Offline
                              raven-worx
                              Moderators
                              wrote on 25 May 2016, 09:42 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 25 May 2016, 11:06 last edited by
                                #19

                                Can there be any alternative to it

                                M 1 Reply Last reply 25 May 2016, 11:27
                                0
                                • Q Qt Enthusiast
                                  25 May 2016, 11:06

                                  Can there be any alternative to it

                                  M Offline
                                  M Offline
                                  mrjj
                                  Lifetime Qt Champion
                                  wrote on 25 May 2016, 11:27 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

                                  14/20

                                  25 May 2016, 08:52

                                  • Login

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