Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • Using QSqlRelationalTableModel issue

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • Qtimer event Slot 1 minute before

    6
    0 Votes
    6 Posts
    4k Views
    E
    ok thanks all for your helps.
  • Adding notes to class pages?

    13
    0 Votes
    13 Posts
    5k Views
    F
    Env: Qt 4.7, OS X 10.6.8, 8 cores, 8 gb, 3 GHz, Macpro, three PCI display cards, six monitors. Behavior is the same on my laptop, though, which is pretty different other than OS. I have: @ CPlotter::CPlotter(QWidget *parent) : QFrame(parent) { setMinimumHeight(384); setMinimumWidth(1280); QSizePolicy policy( QSizePolicy::Expanding, QSizePolicy::MinimumExpanding ); setSizePolicy(policy); setMinimumHeight(384); setMinimumWidth(1280); etc... @ ...and... @ class CPlotter : public QFrame { Q_OBJECT public: explicit CPlotter(QWidget *parent = 0); ~CPlotter(); ...etc @
  • Prevent Translation of Property

    2
    0 Votes
    2 Posts
    2k Views
    M
    replace the line <string>TextLabel</string> with <cstring>TextLabel</cstring>
  • Random crash when the program starts

    19
    0 Votes
    19 Posts
    8k Views
    D
    Hi, After some years of research, i think i've found the problem. The variable that contains a crazy value is initialized in the first thread. And, this variable is used in the second thread. When the program starts, it do that : @lesLiensEtDebits.Traiter(index); lesObs.Traiter(TraitementObs::DROPSETCHARGES);@ NOTE : Traiter( ... ) is a method which start the thread with start(). I put one cout where the 1st thread begin, and another when the 2nd one begin too. When the program starts successfully, there is "one" and "two" at the output. When the program CRASHS, there is "two" and "one" !! IT'S CRAZY ! The second thread began before the first one !! So, i trying to do that correctly, so something like @lesLiensEtDebits.traiter(index); connect(&lesLiensEtDebits, SIGNAL(finished()), &lesObs, SLOT(Traiter(TraitementObs::DROPSETCHARGES)));@ But the program said me an error , it don't find this slot.. The slot is @ void Traiter(TraitementObs::type _choix );@ So i want to pass a parameter in the slot, i don't know if we can do that. Any idea for how to start the 2nd thread AFTER the 1st one finished ? Thanks for your help,
  • Search in my Model efficient way?

    1
    0 Votes
    1 Posts
    905 Views
    No one has replied
  • Qt4.8.0 QAxObject error but 4.7.4 is OK.

    3
    0 Votes
    3 Posts
    5k Views
    J
    Hi, here's what I had to do to get QAxObject back to functional after upgrading the Qt SDK suite (Qt Creator 2.0.1, Qt 4.7.0 to Qt Creator 2.4.1, Qt 4.8.0), with MinGw, without msvs. Starting from a standard Qt SDK installation (./ is the Qt SDK install directory) 1 - Changed the include paths in the following .h files, as there were "file not found" complaints when compiling: in ./Desktop/Qt/4.8.0/mingw/include/ActiveQt/qaxbase.h //#include "../../src/activeqt/container/qaxbase.h" #include "../../QtSources/4.8.0/src/activeqt/container/qaxbase.h" in ./Desktop/Qt/4.8.0/mingw/include/ActiveQt/qaxwidget.h //#include "../../src/activeqt/container/qaxwidget.h" #include "../../QtSources/4.8.0/src/activeqt/container/qaxwidget.h" in ./Desktop/Qt/4.8.0/mingw/include/ActiveQt/qaxfactory.h //#include "../../src/activeqt/control/qaxfactory.h" #include "../../QtSources/4.8.0/src/activeqt/control/qaxfactory.h" in ./Desktop/Qt/4.8.0/mingw/include/ActiveQt/qaxaggregated.h //#include "../../src/activeqt/control/qaxaggregated.h" #include "../../QtSources/4.8.0/src/activeqt/control/qaxaggregated.h" in ./Desktop/Qt/4.8.0/mingw/include/ActiveQt/qaxobject.h //#include "../../src/activeqt/container/qaxobject.h" #include "../../QtSources/4.8.0/src/activeqt/container/qaxobject.h" 2 - As suggested in http://www.qtcentre.org/archive/index.php/t-46402.html?s=113443eeba8f6e35dc6aa161ad2bdb7c , added CONFIG += create_prl CONFIG += link_prl to ./QtSources/4.8.0/src/activeqt/container/container.pro but also to ./QtSources/4.8.0/src/activeqt/control/control.pro so I could get the QAxServer.prl QAxContainer.prl QAxServerd.prl QAxContainerd.prl files 3 - Opened and compiled (for release AND debug) the projects found at: ./QtSources/4.8.0/src/activeqt/container/container.pro ./QtSources/4.8.0/src/activeqt/control/control.pro Make sure you clean them if you tried to compile before the above modifications 4 - Copy the following files (original path may change according to your config when opening the .pro projects for the first time): ./QtSources/4.8.0/src/activeqt/control-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/debug/QAxServerd.prl ./QtSources/4.8.0/src/activeqt/control-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/debug/libQAxServerd.a ./QtSources/4.8.0/src/activeqt/control-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Release/release/QAxServer.prl ./QtSources/4.8.0/src/activeqt/control-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Release/release/libQAxServer.a ./QtSources/4.8.0/src/activeqt/container-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Release/release/QAxContainer.prl ./QtSources/4.8.0/src/activeqt/container-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Release/release/libQAxContainer.a ./QtSources/4.8.0/src/activeqt/container-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/debug/QAxContainerd.prl ./QtSources/4.8.0/src/activeqt/container-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/debug/libQAxContainerd.a to ./Desktop/Qt/4.8.0/mingw/lib/ Be careful not to copy these .prl files, which I'm not sure would work: ./QtSources/4.8.0/src/activeqt/XXXXX-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/release/XXXXX.prl ./QtSources/4.8.0/src/activeqt/XXXXX-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Release/debug/XXXXX.prl (they are in the "debug" directory under the "release" build and vice-versa) 5 - Reboot Yeah, weird, but after doing all that, I kept getting "undefined reference" errors when compiling my projects (some windows library caching?). After a reboot, it worked fine. BR, Joao S Veiga
  • Win32 GetClassName and Qt

    4
    0 Votes
    4 Posts
    5k Views
    M
    bq. And if I change the Qt source code to modify the className, my change doesn’t break anything, does it? I'd venture an educated guess that anytime you change the Qt source code, you run the risk of breaking something.
  • Validating lineEdit fields

    17
    0 Votes
    17 Posts
    15k Views
    F
    You guys are awesome! Thanks a lot
  • Get container index when using QtConcurrent

    8
    0 Votes
    8 Posts
    4k Views
    A
    Yes, C++11 is cool for this, but unfortunately my compiler doesn't support these expressions yet. I'd still prefer a version with iterators though, I think: @ QVector<double> vector(SIZE); double factor = 10; QVector<double>::iterator begin = vector.begin(); QtConcurrent::map(vector, [&factor, begin](QVector<double>::iterator it) { value = factor * (it - begin); }); @
  • ODBC Driver issue

    14
    0 Votes
    14 Posts
    8k Views
    S
    I have the same problem with a Visual Fox Pro database with the ISO Latin-1 character encoding. I use Qt 4.7.4.
  • QShortcut and Mouse Event

    5
    0 Votes
    5 Posts
    4k Views
    L
    [quote author="Tweety" date="1334306908"]Thanks for your reply. Could you provide me an example? [/quote] There should be some code somewhere here lying around... here you go. @ class MouseShortcut : public QObject { Q_OBJECT public: enum ClickType { SingleClick, DoubleClick }; MouseShortcut(MouseShortcut::ClickType type, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, QObject *parent = 0) : QObject(parent) { type_ = type; buttons_ = buttons; modifiers_ = modifiers; doubleClickFilter_.setSingleShot(true); doubleClickFilter_.connect(&doubleClickFilter_, SIGNAL(timeout()), this, SIGNAL(activated())); } signals: void activated(); protected: bool eventFilter(QObject *object, QEvent *event) { if (event->type() == QEvent::MouseButtonPress) { if (type_ == MouseShortcut::SingleClick) { QMouseEvent mouseEvent = static_cast<QMouseEvent>(event); if ((buttons_.testFlag(mouseEvent->button())) && (modifiers_ == mouseEvent->modifiers())) { doubleClickFilter_.start(QApplication::doubleClickInterval()); } } } else if (event->type() == QEvent::MouseButtonDblClick) { if (type_ == MouseShortcut::SingleClick) { doubleClickFilter_.stop(); } else { QMouseEvent mouseEvent = static_cast<QMouseEvent>(event); if ((buttons_.testFlag(mouseEvent->button())) && (modifiers_ == mouseEvent->modifiers())) { emit activated(); } } } return QObject::eventFilter(object, event); } private: MouseShortcut::ClickType type_; Qt::MouseButtons buttons_; Qt::KeyboardModifiers modifiers_; QTimer doubleClickFilter_; }; MouseShortcut *scA = new MouseShortcut(MouseShortcut::SingleClick, Qt::LeftButton, Qt::ControlModifier); MouseShortcut *scB = new MouseShortcut(MouseShortcut::DoubleClick, Qt::LeftButton | Qt::RightButton, Qt::AltModifier | Qt::ShiftModifier); QObject::connect(scA, SIGNAL(activated()), ...); QObject::connect(scB, SIGNAL(activated()), ...); widget.installEventFilter(scA); // widget-local shortcut application.installEventFilter(scB); // application-wide shortcut @ Snippet to terminal.
  • Windows Service with QT Gui and Tray Icon

    6
    0 Votes
    6 Posts
    7k Views
    M
    Thanks for your reply, i was looking something for IPC that's better then my "loopshit" and i think Named Pipes would be the best for me. Now i just need to create the IPC with the two processes. Thanks for your help, mr_einsa
  • Non-static plugin segmentation error

    3
    0 Votes
    3 Posts
    2k Views
    W
    hello mlong, thanks for the reply! the error occours when i emit a virtual funktion of my interface class. that happens only if i have more than one .dll in my plugins folder. if i have only one .dll plugin in it exactly this virtual funktion works perfect. i have tried it with the plug & paint example and there i have the same error if i build a second plugin. this is my interface: @#ifndef HERBERTPLUGINTERFACE_H #define HERBERTPLUGINTERFACE_H #include <QString> #include <QtCore> #include <QMainWindow> class HerbertplugInterface { public: virtual ~HerbertplugInterface() {} virtual QString echoherbertplug(const QString &messageHerbert) = 0; }; Q_DECLARE_INTERFACE(HerbertplugInterface,"com.quins.QuinsMaster.HerbertplugInterface/1.0") #endif // HERBERTPLUGINTERFACE_H@ and here my pro file of the plugin: @QT += core gui sql TEMPLATE = lib CONFIG += plugin INCLUDEPATH += ../Test HEADERS += herbertPlugin.h SOURCES += herbertPlugin.cpp TARGET = $$qtLibraryTarget(herbertplug) DESTDIR = ../plugins FORMS +=@
  • Best practice for passing pointers as sender for async signals

    6
    0 Votes
    6 Posts
    14k Views
    L
    [quote author="Rebell" date="1334246541"]QNetworkAccessManager::finished() also passes heap objects without being tracked by a shared pointer, isn't it? How is reply getting managed when I dont call deleteLater().[/quote]It isn't. If you don't delete the reply you are leaking memory. [quote author="Rebell" date="1334246541"]What should I do, when I want to pass a smart pointer and I dont know, if this object already got referenced counted by another shared pointer.[/quote]There is basically nothing you can do. It is your responsibility as the developer to define the lifetime of objects, who creates them, who deletes them and wheter you are using smart pointers to do (a part of) this job for you. If an object created by you leaves your authority you either have to let it leave as a smart pointer (as in your example) so that it is clear that this object is managed by a smart pointer or you document the lifetime of the object and who is responsible for deleting it. [quote]"QNetworkAccessManager":http://qt-project.org/doc/qt-4.8/qnetworkaccessmanager.html#details ... Note: After the request has finished, it is the responsibility of the user to delete the QNetworkReply object at an appropriate time. Do not directly delete it inside the slot connected to finished(). You can use the deleteLater() function. ...[/quote]
  • 0 Votes
    7 Posts
    8k Views
    Y
    Thanks for help. I can solve the problem with your advice, RaubTieR. This is the right source code. Menuadm.h @ #ifndef MENUADM_H #define MENUADM_H #include <QMainWindow> #include <menudaftar.h> namespace Ui { class MenuAdm; } class MenuDaftar; //add this code class MenuAdm : public QMainWindow { Q_OBJECT public: explicit MenuAdm(QWidget *parent = 0); MenuDaftar *objmain7; ~MenuAdm(); private slots: void btnaction6(); private: Ui::MenuAdm *ui; }; #endif // MENUADM_H @ Menudaftar.h @ #ifndef MENUDAFTAR_H #define MENUDAFTAR_H #include <QMainWindow> #include <menuadm.h> namespace Ui { class MenuDaftar; } class MenuAdm; //add this code class MenuDaftar : public QMainWindow { Q_OBJECT public: explicit MenuDaftar(QWidget *parent = 0); MenuAdm *objmain; //this is an error ~MenuDaftar(); private slots: void btnaction(); private: Ui::MenuDaftar *ui; }; #endif // MENUDAFTAR_H @
  • Facing performance issue with QGraphicsScene and QGraphicsview

    4
    0 Votes
    4 Posts
    3k Views
    A
    What resolution does your screen have, if you need to draw over 80000 line segments? You can probably reduce the number of lines actually drawn quite a bit, without changing a single pixel in the resulting screen output.
  • Object::connect: No such slot QGroupBox::lcs_slot(bool)

    6
    0 Votes
    6 Posts
    4k Views
    A
    Never alter the generated ui_*.h files. From the top of my head, there is even a warning at the top of this file to tell you so. The file will be overwritten the next time you build the application... You can solve this by making the connection in the extensionDlg.cpp file, right after your setupUi() call.
  • How to make a label mouse selectable

    5
    0 Votes
    5 Posts
    7k Views
    A
    You can call: @ theLineEdit->setFrame(false); @ Then, you could also make it disabled. However, that will make the text look greyed out too, so you'd have to eiter set the palette or a style sheet. All in all, I think the QLabel::setTextInteractionFlags() is an easier and better solution.
  • ActiveQt and MVC pattern

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied