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. How to hide this function?
Forum Updated to NodeBB v4.3 + New Features

How to hide this function?

Scheduled Pinned Locked Moved General and Desktop
11 Posts 3 Posters 3.0k Views 1 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.
  • F Offline
    F Offline
    foxgod
    wrote on last edited by
    #1

    http://xiangce.baidu.com/picture/detail/1f3b7ef22e7b961d23a7390158e9f34bc1789ceb
    QTablewidget has a function,when selecte a row ,this row has a color that is diffenernt from other rows. how to hide this function?

    i span two rows' some items,for instance item(0,0),item(0,1),
    item(1,0),item(1,1) by setSpan( 0 , 0, 2, 1 ).the rest item, all up item ,i set a font and color , all down item ,i set a font and color ,now i want to keep up and down item's font and color,
    but when i use stylesheet
    QTableWidget::item:selected{selection-background-color: rgb(62,86,112);selection-color: rgb(255,0,0);}"

    the up and down item's font and color are changed.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Do you mean that you don't want the selection feedback ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • F Offline
        F Offline
        foxgod
        wrote on last edited by
        #3

        i span two rows’ some items,for instance item(0,0),item(0,1),
        item(1,0),item(1,1) by setSpan( 0 , 0, 2, 1 ).the rest item, all up item ,i set a font and color , all down item ,i set a font and color ,now i want to keep up and down item’s font and color,
        but when i use stylesheet
        QTableWidget::item:selected{selection-background-color: rgb(62,86,112);selection-color: rgb(255,0,0);}”

        the up and down item’s font and color are changed.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Could you post images of what is happening ?

          I'm not sure I am following you right

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • F Offline
            F Offline
            foxgod
            wrote on last edited by
            #5

            http://xiangce.baidu.com/picture/detail/1f3b7ef22e7b961d23a7390158e9f34bc1789ceb

            it's my image,thank you.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              I think I'm starting to understand, could post a little code example that reproduce the behavior you are getting ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • F Offline
                F Offline
                foxgod
                wrote on last edited by
                #7

                @initAItemUpData( QVector<QString> Info, QString Align, QFont upFort, QColor upcolor,int index)
                {

                int textAlign = ConvertNameToIndex( Align );
                for( int i = 0,j = 0; i < m_cellRow && j < Info.count(); i++ )
                {
                    if( i %3 == 0 )
                    {
                        this->setItem(i, index, new QTableWidgetItem(Info.at(j)));
                
                        if( AlignLeft == textAlign )
                        {
                           this->item(i, index)->setTextAlignment(Qt::AlignLeft);
                        }
                        else if( AlignCenter == textAlign )
                        {
                            this->item(i, index)->setTextAlignment(Qt::AlignCenter);
                        }
                        else if( AlignRight == textAlign )
                        {
                            this->item(i, index)->setTextAlignment(Qt::AlignRight);
                        }
                        this->item(i, index)->setFont(upFort);
                        this->item(i, index)->setTextColor(upcolor);
                       j++;
                    }
                }
                

                }
                initAItemDownData( QVector<QString> Info, QString Align, QFont downFort, QColor downcolor,int index )
                {

                int textAlign = ConvertNameToIndex( Align );
                for( int i = 0,j = 0; i < m_cellRow && j < Info.count(); i++ )
                {
                    if(i %3 == 1 )
                    {
                        this->setItem(i, index, new QTableWidgetItem(Info.at(j)));
                
                        if( AlignLeft == textAlign )
                        {
                            this->item(i, index)->setTextAlignment(Qt::AlignLeft);
                        }
                        else if( AlignCenter == textAlign )
                        {
                            this->item(i, index)->setTextAlignment(Qt::AlignCenter);
                        }
                        else if( AlignRight == textAlign )
                        {
                            this->item(i, index)->setTextAlignment(Qt::AlignRight);
                        }
                        this->item(i, index)->setFont(downFort);
                        this->item(i, index)->setTextColor(downcolor);
                       j++;
                    }
                }
                

                }@

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  shadabk92
                  wrote on last edited by
                  #8

                  Hello,
                  What do you exactly mean by you want to "hide this function"?
                  Please elaborate "hide this function" exactly.
                  Are you stating that you would like to not have that function?
                  or
                  Are you trying to change the function so that you can use the stylesheet to color the textareas as you prefer?

                  1 Reply Last reply
                  0
                  • F Offline
                    F Offline
                    foxgod
                    wrote on last edited by
                    #9

                    I use stylesheet to change tablewidget's color . i set item's font and font's color,but when i selected a row ,font's color is change,it's not original's color that i set.this 'is my image;
                    http://xiangce.baidu.com/picture/detail/1f3b7ef22e7b961d23a7390158e9f34bc1789ceb
                    now ,my one row is two rows,i span two rows to one row.

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      shadabk92
                      wrote on last edited by
                      #10

                      Correct me if I am wrong, would you like to use stylesheets or internally change the functions in C++ to color the text?

                      1 Reply Last reply
                      0
                      • F Offline
                        F Offline
                        foxgod
                        wrote on last edited by
                        #11

                        may be my english is not well, i want to set color when i selecte one row.so ,i use stylesheets ,for instance,
                        @QTableWidget::item:selected{selection-background-color: rgb(53,96,138);
                        @
                        but one qustion appear,i have setted item's text color in one row,but my one row is not real one row , i span (0,0,2,1) in two rows.

                        when i use stylesheets to set selecte one row's color,the item's text color can be change,for intance , the original item's text color is red ,when i cliked one row ,item's text color is not red .
                        please see my tablewidget's image.the web address is :
                        http://xiangce.baidu.com/picture/detail/1f3b7ef22e7b961d23a7390158e9f34bc1789ceb
                        you can see my original's item's text color and selected item's text color .
                        how to do it that when i selecte one row,the item's text color is the same with original's item's text color that i setted.
                        thank you

                        1 Reply Last reply
                        0

                        • Login

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