Tree within a Grid

Moderator: Rathinagiri

User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Tree within a Grid

Post by Rathinagiri »

U R a real Transformer Rossine!
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Rossine
Posts: 87
Joined: Thu Jun 30, 2011 10:04 pm

Re: Tree within a Grid

Post by Rossine »

Hello All,

QT is really powerful. :o

Many thanks to Roberto for starting this wonderful project and all who contribute to it to grow :D

I found the necessary functions for these implementations and tested only. I'll pass along to you where I implemented for you to see the best way to use them:

in TREE.PRG:

Code: Select all


/*..............................................................................
   New
..............................................................................*/
METHOD New( cName, oParent ) CLASS TREE

...
   ::HeaderItem( .T. )                                         // this don't show header. If you add a Caption to the QtreeWidget it will be .F.
   ::Expanding( .T. )                                          // This property holds whether to show controls for expanding and collapsing top-level items
   ::Animation( .T. )                                          // This property holds whether animations are enabled

   ::oQTObject:setColumnCount( 3 ) // rossine
   ::oQtObject:setSortingEnabled( .T. ) // rossine

RETURN Self

...

/*..............................................................................
   Caption
..............................................................................*/
METHOD Caption( cArg1 ) CLASS TREE
...
   ELSEIF PCOUNT() == 1
      IF hb_IsChar( cArg1 ) == .T.
         ::cCaption := cArg1
         ::oQtObject:setHeaderLabel( ::cCaption )

         ::oQTObject:headerItem():settext( 1, "coluna 2" ) // rossine
         ::oQTObject:headerItem():settext( 2, "coluna 3" ) // rossine

         ::HeaderItem( .F. )
...

/*..............................................................................
   Caption
..............................................................................*/
METHOD Caption( cArg1 ) CLASS TREEITEM

...

   ELSEIF PCOUNT() == 1
      ::oQtObject:setText( 0, cArg1 )

      ::oQtObject:setText( 1, "ola2" ) // rossine
      ::oQtObject:setText( 2, "ola3" ) // rossine

      ::oQtObject:setToolTip( 0, "tool1" ) // rossine
      ::oQtObject:setToolTip( 1, "tool2" ) // rossine
      ::oQtObject:setToolTip( 2, "tool3" ) // rossine

      ::oQtObject:settextAlignment( 0, 0 ) // rossine
      ::oQtObject:settextAlignment( 1, 1 ) // rossine
      ::oQtObject:settextAlignment( 2, 1 ) // rossine

...

/*..............................................................................
   ItemImages
   TODO: remove/disable icons
..............................................................................*/
METHOD ItemImages( aArg1 ) CLASS TREEITEM

...

      IF LEN( aArg1 ) >= 1
         ::aImages  := aArg1
         oNewIcon := QPixmap( ::aImages[1] )
         ::oIcon:addPixmap( oNewIcon, QIcon_Normal, QIcon_On )
         ::oQtObject:setIcon( 0, ::oIcon ) // rossine
         ::oQtObject:setIcon( 1, ::oIcon ) // rossine
         ::oQtObject:setIcon( 2, ::oIcon ) // rossine
         IF LEN( ::aImages ) == 2
            oNewIcon := QPixmap( ::aImages[2] )
            ::oIcon:addPixmap( oNewIcon, QIcon_Selected, QIcon_On )
            ::oQtObject:setIcon( 0, ::oIcon ) // rossine
            ::oQtObject:setIcon( 1, ::oIcon ) // rossine
            ::oQtObject:setIcon( 2, ::oIcon ) // rossine
         ENDIF
      ENDIF

Perhaps this could be implemented like this:

Code: Select all

         NODE "Item1"
            TREEITEM { "Item1.1", "Item1.1.1", "Item1.1.2"}
            TREEITEM { "Item2.1", "Item2.1.1", "Item2.1.2"}
         END NODE

Thank you for the attention of all ;)

Rossine.
mrduck
Posts: 497
Joined: Fri Sep 10, 2010 5:22 pm

Re: Tree within a Grid

Post by mrduck »

Rossine wrote:
QT is really powerful. :o
Did you notice it ?


:-)
Rossine
Posts: 87
Joined: Thu Jun 30, 2011 10:04 pm

Re: Tree within a Grid

Post by Rossine »

mrduck wrote:
Rossine wrote:
QT is really powerful. :o
Did you notice it ?

:-)
Yes :lol:

If you want I can set up an outline of how the would be new command accepting tree for mult-columns. What do you think ?

Best Regards,

Rossine.
Post Reply