Questions tagged [qset]

QSet is a template class from the Qt Toolkit that provides a hash-table-based set. QSet is one of Qt's generic container classes. QSet is unordered, so an iterator's sequence cannot be assumed to be predictable. If ordering by key is required, use a QMap. QSet stores values in an unspecified order thus lookup of value is fast. Internally, QSet is implemented as a QHash. QSet supports both Java-style iterators and STL-style iterators.

Documentation can be found here (Qt4) and here (Qt5).

9 questions
3
votes
2 answers

QT container, with specified order and no repetitions

I need somthing similar to QSet, but I need the items to be saved on the order I inserted them is there such thing?
kakush
  • 3,334
  • 14
  • 47
  • 68
3
votes
2 answers

QSet: error with qHash and custom class

I want to create a QSet that I want to use inside my program. Tag is my custom class. When I build the code I obtain gcc errors regarding the qHash overloading: Exercise.cpp.o In file included from…
Jepessen
  • 11,744
  • 14
  • 82
  • 149
3
votes
2 answers

How to modify elements of a QSet?

I have QSet texture; and I would like modify all QuadPattern in a loop. foreach is not the good solution because it makes a copy. With this code : QMutableSetIterator it(texture); while (it.hasNext()) { it.next(); …
artoon
  • 729
  • 2
  • 14
  • 41
1
vote
1 answer

QSet append custom Object

I have the following class class Test{ int a; int b; }; and all that I want is to have a QSet where I will insert some Test objects. int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QSet setTest; …
Mircea
  • 1,671
  • 7
  • 25
  • 41
1
vote
0 answers

QMap insertMulti vs QMap >

I was looking at storing a set of values in a map, with an int as a key: - QMap > setOfValues; While reading the documentation, I noticed that QMap provides the insertMulti function, to allow inserting multiple values for the…
TheDarkKnight
  • 27,181
  • 6
  • 55
  • 85
0
votes
1 answer

Insertion into QSet vs QHash

I would like to know how insert into QSet exactly works. Does QSet compare all items with the new item while inserting? Because if it does, i would use QHash with a simple ID as key instead of using QSet with a container class, which has more…
dce_54
  • 1
  • 1
0
votes
1 answer

(De)serialization QSet with enum using QDataStream

I use Qt 4.8.7. I have enum Color {red, green, blue} and QSet. How should I (de)serialize QSet using QDataStream? Deserialization fails with custom type. Should I manually create serialization (loop over QSet elements) besides…
ilya
  • 1,103
  • 14
  • 36
0
votes
1 answer

How to use QSet as value in QMap?

I'm using Qt and I want to declare following container: QMap > map; Here ClassSharedPtr is the boost shared ptr of class "Class". typedef boost::shared_ptr ClassPtr; I'm getting following errors after…
BSalunke
  • 11,499
  • 8
  • 34
  • 68
-1
votes
3 answers

For Loop Misbehavior in C++ and Qt 6.2

First of all i'm a complete beginner in C++ and Qt and i'm using Qt 6.2 and C++11. This is the code that i have problem with: QSet> listSet; for(int i = 0; i < 10; i++) { QList myList; for(int r = 0; r < 10; r++) …
A . R . B
  • 27
  • 5