Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • Creating matrix of label in constructor

    6
    0 Votes
    6 Posts
    4k Views
    W
    if i want to keep a unsigned for each label: @ struct Card{ QLabel ilabel; unsigned status; }; class PlayForm : public QDialog { Q_OBJECT Card* ImageMatrix; public: PlayForm(); virtual ~PlayForm(); public slots: void Pause(); void Quit(); private: Ui::PlayForm widget; }; @ In the constructor: @ PlayForm::PlayForm() { widget.setupUi(this); ImageMatrix = new Card[9]; int X = 70, Y = 30; for(int i = 0; i < 9; i++){ ImageMatrix[i].ilabel = new QLabel(this); ImageMatrix[i].ilabel.setObjectName(QString::fromUtf8("label_" + i)); ImageMatrix[i].ilabel.setGeometry(X,Y,81,121); ImageMatrix[i].ilabel.setPixmap(QPixmap(QString::fromUtf8("dist/Debug/GNU-Linux-x86/retro_3.png"))); if(X < 310) X += 120; else{ X = 70; if(Y < 310) Y += 140; else Y = 30; } } } @ Error: @ PlayForm.cpp:16:48: error: no match for ‘operator=’ in ‘(((PlayForm*)this)->PlayForm::ImageMatrix + ((long unsigned int)(((long unsigned int)i) * 48ul)))->Card::ilabel = (QFlagsQt::WindowType(0u), (operator new(40u), (<statement>, ((QLabel*)<anonymous>))))’ PlayForm.cpp:16:48: note: candidate is: /usr/include/qt4/QtGui/qlabel.h:165:5: note: QLabel& QLabel::operator=(const QLabel&) /usr/include/qt4/QtGui/qlabel.h:165:5: note: no known conversion for argument 1 from ‘QLabel*’ to ‘const QLabel&’ @ Why the same error? EDIT: It works now, here the new code of the constructor: @ PlayForm::PlayForm() { widget.setupUi(this); ImageMatrix = new Card[16]; int X = 70, Y = 30; for(int i = 0; i < 16; i++){ ImageMatrix[i].ilabel = new QLabel(this); ImageMatrix[i].ilabel -> setObjectName(QString::fromUtf8("label_" + i)); ImageMatrix[i].ilabel -> setGeometry(X,Y,81,121); ImageMatrix[i].ilabel -> setPixmap(QPixmap(QString::fromUtf8("dist/Debug/GNU-Linux-x86/retro_3.png"))); //QObject::connect(ImageMatrix[i].ilabel, SIGNAL(clicked()), this, SLOT(Modifica(i))); ImageMatrix[i].status = 0; //Coperta if(X < 430) X += 120; else{ X = 70; if(Y < 450) Y += 140; else Y = 30; } } } @
  • How to "signal" from a non-QObject?

    7
    0 Votes
    7 Posts
    9k Views
    A
    Yes, foxyz, that's what I want to do. Oh, well, Ideally I'd want SkypeWrapper (or MySkype in your example) just be QObject so that they could both do some processing and propagate signals further if needed. Your example is interesting: you put the whole layer of QSkype, QConversation, QParticipant, etc into a single MyEventDispatcher. Thanks for the idea, I'll think whether it is more elegant for my case. Tradeoffs will mostly have to be considered on whether I really want the dispatcher (QSkype, QConversation, etc) be just a dispatcher (with app logic somewhere else) or I if want QSkype, QCOnversation, etc actually contain a decent amount of logic
  • [closed] how to inherit QObject type class from template type class.??

    Locked
    4
    0 Votes
    4 Posts
    6k Views
    A
    I am closing this topic. You already have a topic on this question, and that topic clearly explains why this is not possible. Just opening another topic with the same question is not going to help you solve this. Continue the older topic if you have more questions left.
  • Problem with QSqlField.type() (when used with QSqlTableModel)

    4
    0 Votes
    4 Posts
    3k Views
    F
    QVariant::Type is an enum (int) type
  • Bug or feature with QNetworkRequest in qt 4.8.0 ?

    5
    0 Votes
    5 Posts
    3k Views
    B
    Ok. Thanks
  • How to create Deployment package for Desktop?

    Locked
    6
    0 Votes
    6 Posts
    3k Views
    K
    Double posting "see":http://developer.qt.nokia.com/forums/viewthread/14496/ Therefore thread closed
  • How to create a form that stores the values in a Database?

    4
    0 Votes
    4 Posts
    2k Views
    S
    Hi, Can I get any link which shows how to use QT with MSAccess or SQLite? Thanks, Siva
  • Strange behavior when set data back from delegate to model

    3
    0 Votes
    3 Posts
    2k Views
    G
    Patience is a virtue. Please wait at least a couple of days until bumping a topic. It might take some time until someone familiar with the topic reads your post. Thank you. And of course: welcome to DevNet!
  • [Solved] Setting the alignment in a QTableWidget

    2
    0 Votes
    2 Posts
    7k Views
    G
    Just call "setTextAlignment() ":/doc/qt-4.8/qtablewidgetitem.html#setTextAlignment on the [[Doc:QTableWidgetItem]]s.
  • 0 Votes
    11 Posts
    8k Views
    R
    Thanks Volker
  • Swf content in PDF document, how to display it in the app?

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • [Solved] setWindowTitle was not declared in this scope

    5
    0 Votes
    5 Posts
    5k Views
    K
    marked as solved
  • Question about GPL

    3
    0 Votes
    3 Posts
    2k Views
    L
    Yeah, it would be too easy to get around the license. hehe Thanks for the answer. :D
  • QtWebKit - pixelated since 4.8.0

    10
    0 Votes
    10 Posts
    5k Views
    M
    Also there is SmoothPixmapTransform - that should cover it. I have it turned on of course.
  • Changing look of persistent editors in QTableView

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • [Solved] How to get file location from QTreeView

    3
    0 Votes
    3 Posts
    3k Views
    M
    Be sure and edit your first post to add [Solved] to the title if you've got it working. Thanks!
  • Automagically generate labels and editing widgets for a QDataWidgetMapper

    4
    0 Votes
    4 Posts
    3k Views
    A
    I just discovered that up to Qt3 it was used to exist a QSqlForm and that it is still supported (but deprecated): "Q3SqlForm":http://developer.qt.nokia.com/doc/qt-4.7/q3sqlform.html This would have been very near to what I was looking for. Strangely enough, starting from Qt 4.X this component has been abandoned. The existing SQL Module contains just a Table and a Tree View (both well fit for the "master" view in a typical master/detail architecture). No more Form View (useful for the "detail" part of the master/detail). See: "QtSQL Module":http://developer.qt.nokia.com/doc/qt-4.7/qtsql.html "Qt SQL Programming":http://developer.qt.nokia.com/doc/qt-4.7/sql-programming.html "Porting to Qt4":http://developer.qt.nokia.com/doc/qt-4.7/porting4.html This is quite surprising, given that database front-ends (and database editing/reading forms) are a typical use-case for the Qt Library. I wonder if this feature is planned for re-introduction in Qt5 or later.
  • Searching your project for all src/*/*.cpp files

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • Qt5: Javascript vs C++?

    23
    0 Votes
    23 Posts
    18k Views
    S
    [quote author="Tobias Hunger" date="1329228289"]Actually I am not afraid about my future here in Nokia, hacking on Qt Creator. I am still very happy with how Qt 5 is progressing, and am still adding Qt widgets all over creator:-)[/quote] This is very nice to know! :-)
  • 0 Votes
    2 Posts
    2k Views
    G
    You can set some render hints from the model: "QAbstractItemModel:data":http://developer.qt.nokia.com/doc/qt-4.8/qabstractitemmodel.html#data and use the font role