anything related to UI in general, splash screens, UI widgets, input and output etc.

Get ALL Selected Items in List Widget

Get ALL Selected Items in List Widget

Postby Shando » 05 Jul 2015, 11:57

Sorry, me again :mrgreen:

Is it possible to get ALL selected items in a List Widget where I have set the "Selection Mode" to "Multi-Selection" in Qt Designer?

I suppose I should also ask the same question regarding Tables and Trees?

Thanks

Shando
Alienware 17 (i7-4700MQ 2.4GHz 16GB GTX770M Win 10 64)

Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 492
Joined: 06 Mar 2013, 22:35
Location: Kings Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer

Re: Get ALL Selected Items in List Widget

Postby SolarPortal » 05 Jul 2015, 12:59

will add this to the list of all the other bits you require as i don't think multi selection has an API set of functions just yet. It can be made to do so though.
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 3770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3202
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Get ALL Selected Items in List Widget

Postby Shando » 26 Nov 2015, 04:17

Hi SP,

Were these functions implemented, as I can't seem to locate any updates regarding the "multi-select" in Widgets?

Thanks

Shando

PS: I printed out a copy of all Skyline Functions (using the Lua Global Table), and noticed that "qt.setFocus" comes through as "qt.setFocues"??
Alienware 17 (i7-4700MQ 2.4GHz 16GB GTX770M Win 10 64)

Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 492
Joined: 06 Mar 2013, 22:35
Location: Kings Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer

Re: Get ALL Selected Items in List Widget

Postby SolarPortal » 26 Nov 2015, 11:08

aah, must have missed this one lol :P

I printed out a copy of all Skyline Functions (using the Lua Global Table), and noticed that "qt.setFocus" comes through as "qt.setFocues"??


lol, then this explains why it never worked lmao :D
Fixed :D
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 3770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3202
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Get ALL Selected Items in List Widget

Postby SolarPortal » 28 Nov 2015, 17:34

I have just fixed the closeEditor which was missing the code again.. strange, must have been the IDE lol :P

Added newly today for the tree, list and table widgets:
Code: Select all
qt.setSelectionMode(editorName, objectName, mode (int))
-- | and the
selectionMode = getSelectionMode(editorName, objectName);


Currently, the get all items functions for each widget type are being added, but we already have a tree version.

Code: Select all
qt.getAllTreeIDs(editorName, objectName);


And for Tables, you can use the:

Code: Select all
numRows = qt.getNumTableRows(editorName, objectName);
numColumns = qt.getNumTableColumns(editorName, objectName);


The getSelectedItems function is also now under way :)
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 3770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3202
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Get ALL Selected Items in List Widget

Postby SolarPortal » 28 Nov 2015, 21:58

After a while of testing, i am now complete and have a working function implementation to get the selected ids of a treeWidget, listWidget and tableWidget. This will be part of the next release

Here is how you use them:

QTreeWidget
Code: Select all
function getTreeSelectedItems() -- | This is a pushButton to trigger the ID Grab
   value = qt.getSelectedItems(thisEditor, "treeWidgetExample");
   
   if(type(value) == "table")then
      lprint("Successfully got data back");
      for i, v in ipairs(value) do
         lprint("#&255,255,255:selected ID: "..i);
         lprint("#&200,200,255:    v: "..v);            
      end
   else
      lprint("Failed to grab selected ids from the tree widget");
   end
end



QlistWidget
Code: Select all
function getListSelectedItems()
   value = qt.getSelectedItems(thisEditor, "listWidgetExample");
   
   if(type(value) == "table")then
      --lprint("Successfully got data back");
      for i, v in ipairs(value) do
         lprint("#&255,255,255:selected ID: "..i);
         lprint("#&200,200,255:    v: "..v);      
      end
   else
      --lprint("Failed to grab selected ids from the tree widget");
   end
end


QTableWidget
The previous 2 functions were already returning a single table array with only 1 value.
Since the TableWidget uses rows and columns, we had to change it slightly.

Code: Select all
function getTableSelectedItems()
   value = qt.getSelectedItems(thisEditor, "tableWidgetExample");
   
   if(type(value) == "table")then
      --lprint("Successfully got data back");
      for i, v in ipairs(value) do
         rowIndex = v[0];
         columnIndex = v[1];
         
         lprint("#&255,255,255:selected ID: "..i);
         lprint("#&200,200,255:    rowIndex: "..rowIndex);
         lprint("#&200,200,255:    columnIndex: "..columnIndex);
      end
   else
      lprint("Failed to grab selected ids from the tree widget");
   end
end


Anyway, i think that is all of the tasks that were requested here :)
Hope this helps :D
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 3770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3202
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Get ALL Selected Items in List Widget

Postby Shando » 29 Nov 2015, 00:27

Hi SP,

Thanks for all of these changes, my plugins are almost there 8-)

One *final* request......

Would it be possible to SET multiple indices as well?

All I'm thinking is that a user selects multiple items in a List Box, Table etc. and then adds their selections to a Main Table Widget (via a button press). Then, when they select that row in the Main Table Widget, the List Box, Table etc. gets each of the previously selected items highlighted??

Thanks

Shando
Alienware 17 (i7-4700MQ 2.4GHz 16GB GTX770M Win 10 64)

Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 492
Joined: 06 Mar 2013, 22:35
Location: Kings Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer

Re: Get ALL Selected Items in List Widget

Postby SolarPortal » 29 Nov 2015, 13:32

I can have a look at creating a set selected ids. :)

Edit: I have implemented the setSelected and also a single getSelected in 3 different commands as they work slightly differently each time.

Code: Select all
-- | 1 = selected, 0 = not selected

qt.setTreeSelectedItem(editorName, objectName, id, selected (int));
isSelected = qt.getTreeSelectedItem(editorName, objectName, id);

qt.setListSelectedItem(editorName, objectName, id, selected (int));
isSelected = qt.getListSelectedItem(editorName, objectName, id);

qt.setTableSelectedItem(editorName, objectName, row, column, selected (int));
isSelected = qt.getTableSelectedItem(editorName, objectName, row, column);



Just use a loop to set all the ids to the selected status you want :)

Hope these help :D

Edit: Also i am adding another command to deselect all items. Done!

Code: Select all
qt.deselectAllItems(editorName, objectName);
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 3770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3202
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer


Return to UI

Who is online

Users browsing this forum: No registered users and 1 guest