Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • [SOLVED] problem with two classes in the same file

    9
    0 Votes
    9 Posts
    7k Views
    K
    [quote author="BilbonSacquet" date="1321431599"]why did you not simply give to the server a main window pointer:[/quote] I think what Andre was saying in the first reply was that the mainwindow is a qwidget and server is an qobject. therefore i get this error when running your code. error: cannot convert 'QObject*' to 'MainWindow*' in initialization. I have decided that i am going to use signal and slot. thank you
  • How to create a QMap of objects?

    17
    0 Votes
    17 Posts
    19k Views
    G
    Having it in a class as a container is a good idea. I do that in my project too. If you put them into a container as values (i.e. not as pointers), just make sure to have the implemented the assignment operators etc. It's not much work. Have a look at the following topcis of the "C++ FAQs":http://www.parashift.com/c++-faq-lite/ "Constructors":http://www.parashift.com/c++-faq-lite/ctors.html "Assignment operators":http://www.parashift.com/c++-faq-lite/assignment-operators.html And read on that FAQs in general - it's a pretty good source of valuable information! PS: If your ObjsClass object is long living (which I assume), it is ok to have the myObjs as a regular member, not as a pointer.
  • Pushbutton on top of a big pushbutton

    4
    0 Votes
    4 Posts
    3k Views
    S
    Thank you! I found it that there was a overlap of some drawings of my big button on smaller button.
  • QString and c++ unicode escapes

    3
    0 Votes
    3 Posts
    6k Views
    G
    Thanks Gerolf! My brain wasn't working so well this morning. As you point out, what is happening is obvious since the compiler replaces the literals before QString sees them.
  • Class has no metaobject information?

    3
    0 Votes
    3 Posts
    5k Views
    F
    Ok, I've tried from CMDLine its working. But like to know the root cause for it. Here is my class interface, @ // COM dll (no UI component) #include <ActiveQt/QAxBindable> #include "classM.h" #include "classA_global.h" #include <qobject.h> #include <QMetaObject> struct key { int someVar; }; // , class CLASSA_EXPORT classA : public QObject, public QAxBindable , public scanner { Q_OBJECT public: classA( QObject p = 0); STDMETHOD(Init)(LPTNTDRVINFO pDrvInfo); // 3rd part "scanner" virtual function ULONG STDMETHODCALLTYPE AddRef( void); ULONG STDMETHODCALLTYPE Release( void); STDMETHOD(QueryInterface)( / [in] / REFIID riid, / [iid_is][out] */ __RPC__deref_out void __RPC_FAR *__RPC_FAR *ppvObject); public slots: QString getSaampleData(); private: //bla bla bla... }; QAXFACTORY_DEFAULT(classA, "{20C63A76-5FEF-49C8-8E83-26957590748B}", "{BE690126-A3413-47D1-A278-1E69FCD1B61E}", "{0DED1E03-D4F2-44C3-8B67-56F4D7D87661}", "{5263E150-F234-4AE0-9E38-CBE753E936C0}", "{96AB3485-1234-4B60-BB62-5C77C22EF154}") // singleton class interface. dll #include <QObject> #include<QVariant> #include <QList> #include <QMetaObject> #include "singleton_global.h" #include <qDebug.h> class SINGLETON_EXPORT singleton : public QObject { Q_OBJECT static bool instanceFlag; static singleton single; singleton(); singleton(const singleton&); public: static singleton getInstance(); ~singleton(); QMap<QString, struct key*> getMapVar(); private: QMap<QString, struct key*> MapVar; }; // implementation of CLASSA(COM object). QString ClassA::getSaampleData(){ QMap<QString, struct key*> tempMapVar; tempMapVar = singleton::getInstance()->getMapVar(); // gives error while building , class do not have metaobject... } // console application main() { ClassALib::IClassPtr obj; HRESULT hr = CoInitialize(NULL); if (FAILED(hr)) { #if _DEBUG qDebug("CoInitialize Failed"); #endif return -1; } obj.CreateInstance("{20C63A76-5FEF-49C8-8E83-26957590748B}"); if(!obj) { return -1; } obj->getSaampleData(); } @ This is how my interface looks like,
  • How to use a dll function

    20
    0 Votes
    20 Posts
    14k Views
    G
    hi shisen, what you ask is a new topic. please open a new thread for it. Thanks.
  • QTListView with Item delegate - Taller item rows for selected items

    3
    0 Votes
    3 Posts
    4k Views
    R
    This is what I ended up doing Andre, the user won't notice it, but it's rather sad that true dynamic row height modifications require a phantom "nowhere to nowhere" resize for QListView controls. I thought i'd find better support for such a basic functionality from a tool as advanced as Qt. Unfortunately I can't move to QML right now- i've invested too much effort already on my custom drawn QListView. Thanks for your response.
  • [closed] adding another column to QFileSystemModel

    Locked
    7
    0 Votes
    7 Posts
    6k Views
    A
    [quote author="rturrentine" date="1321455547"]phamtv - Did you ever come up with a solution? I need to do the same thing.[/quote] You asked the "same":http://developer.qt.nokia.com/forums/viewreply/63770/ thing already in another topic. Please don't do that. Closing this topic.
  • Can we read and paint svg image in qt?

    9
    0 Votes
    9 Posts
    5k Views
    G
    Then state so clearly please. You're talking about painting on widgets on the first post. Nobody else than you knows that you're switching topics and talking about style sheets now. It would help if you added something like an "additional question" to one of your answers. A bit more explanation would help avoiding such confusion. Now that things are sorted out: I don't have experiences with styles sheets on widgets, so no statement on that from my side, sorry.
  • 0 Votes
    2 Posts
    2k Views
    A
    Why would you think there is a 1:1 mapping between file extensions and video formats? Most of the file extensions in use are just container formats, that can contain many different types of video formats that you may or may not have the right codec for.
  • QDialog modal issue

    4
    0 Votes
    4 Posts
    7k Views
    P
    Hi, I had a similar problem, and i have solved it by calling show() instead of exec(). Hope it helps you. mydialog.setModal(true); mydialog.show();
  • Qt creator: Game Buttons and Menus

    Locked
    5
    0 Votes
    5 Posts
    4k Views
    G
    Closed topic. Please follow up in the thread that Andre linked.
  • Delay for QLabel test update

    7
    0 Votes
    7 Posts
    5k Views
    G
    A [[doc:QProgressDialog]] seems to be a better solution for this than a QLabel. Have a look at "this older thread":/forums/viewthread/1436, especially at the "snippet here":/forums/viewreply/43702/. Edit: fixed documentation link from QProcessDialog to QProgressDialog; Andre
  • How to hide windows close/minimize/maximize button on titlebar?

    11
    0 Votes
    11 Posts
    40k Views
    J
    try setting the form's minimum size equal to the form's maximum size. it worked for me. except for the close button.... I use the QcloseEvent() to handle that...
  • [Solved]Login dialog and problem with quit app

    6
    0 Votes
    6 Posts
    6k Views
    H
    I tested a solution and I have a conclusion: This is wrong: @ return 0; @ In Qt Creator I have a message that application was unexpected closed. This is good: @ exit( 0 ); @
  • [Moved] How to fill color in a circle

    4
    0 Votes
    4 Posts
    5k Views
    A
    [quote author="Lukas Geyer" date="1321426763"]Welcome to the QtDN. I have another "good read":http://www.catb.org/~esr/faqs/smart-questions.html for you.[/quote] Indeed. Take special note of "this":http://www.catb.org/~esr/faqs/smart-questions.html#urgent part.
  • 0 Votes
    11 Posts
    18k Views
    P
    actually i don't able to find what was the problem. i have just restarted my system after that it was working.
  • Browser Plugin with Live555

    1
    0 Votes
    1 Posts
    3k Views
    No one has replied
  • Receive POST request

    4
    0 Votes
    4 Posts
    4k Views
    P
    Thank you for the link on parser, i'll use it.
  • Need save/restore QMainWindow minimized state

    9
    0 Votes
    9 Posts
    7k Views
    L
    [quote author="Gourmand" date="1321383818"]I just wanna discuss this before bugtracking.[/quote] Well, I'm against this change then. I see no sense in letting QMainWindow::saveState() store the widgets state as there is no connection to its primary role (state of toolbars and dock widgets) and it is available to QMainWindow only. Such behaviour would be quite inconsistent and confusing. QWidget::saveGeometry() is responsible for saving a widgets geometry (size and position). The window state of a widget does not influence the geometry and vice versa - these are two independent properties of a widget of thus should have two independent setters and getters (otherwise I couldn't set one without the other). I do not expect that both, QMainWindow::restoreState() and QWidget::restoreGeometry(), modify the window state of a widget, as it has neither to do with a toolbar and dock widget state (state) or a widgets size and position (geometry). There is already an existing method for exactly this purpose: QWidget::windowState(). Such a change might break existing applications. What's the difference between @ settings.setValue("geometry", widget.saveGeometry()); settings.setValue("state", widget.saveState()); widget.restoreGeometry(settings.value("geometry").toByteArray()); widget.restoreState(settings.value("state").toByteArray()); @ and @ settings.setValue("geometry", widget.saveGeometry()); settings.setValue("state", widget.saveState()); settings.setValue("windowstate", static_cast<int>(widget.windowState())); widget.restoreGeometry(settings.value("geometry").toByteArray()); widget.restoreState(settings.value("state").toByteArray()); widget.setWindowState(static_castQt::WindowState(settings.value("windowstate").toInt())); @ besides an additional line of code that would justify these serious changes?