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] Return time in UTC with Qt 4.7

    4
    0 Votes
    4 Posts
    3k Views
    T
    Thank you! Richard
  • [solved] deleteLater() ?

    4
    0 Votes
    4 Posts
    10k Views
    T
    Yes it does, :) I was facing a crash after a long button press (deleted the object after timeout) and the issue was probably that there was some action referring to the object active in the queue. Adding delete later solved the issue, and I added a qdebug to the deconstructor just to be sure it is deleted, as so it is. Thank you. Richard
  • Deployment problems on Mac OSX

    16
    0 Votes
    16 Posts
    9k Views
    F
    Thank you very much Volker!
  • 0 Votes
    7 Posts
    5k Views
    K
    Thanks Lukas, your trick worked! As I could understand the thread object belongs to the main application, so the events sent to that object are handled by the main event loop. That explains why the finished() signal was never handled.
  • Find list of special folders in Windows using Qt

    2
    0 Votes
    2 Posts
    3k Views
    L
    "QDesktopServices":http://developer.qt.nokia.com/doc/qt-4.8/qdesktopservices.html#storageLocation For the Windows folder I either would use qgetenv("WINDIR") or native GetWindowsDirectory(). Use QFile or QFileInfo to determine if the directory is writable or not.
  • Qt project developed in Windows not working properly in Unix

    2
    0 Votes
    2 Posts
    1k Views
    F
    Well, as the "documentation":http://developer.qt.nokia.com/doc/qt-4.8/qtabwidget.html#tabsClosable-prop reports for instance in the case of the first line of code, the method setTabsClosable has been introduced since Qt 4.5. You are developing with very different versions of Qt, so the only thing you have to do is either upgrade the Linux library or downgrade the Windows one and develop with the same version.
  • QObject::connect crashing

    5
    0 Votes
    5 Posts
    3k Views
    D
    Okay here is the code: header file for moc file generation @ #pragma once #include <QDockWidget> namespace Ui { class EditToolWidget; } class EditToolImpl : public QObject { Q_OBJECT public: EditToolImpl(QDockWidget& parent); ~EditToolImpl(void); public slots: void colorToolButtonClicked(); private: Ui::EditToolWidget *m_ui; }; @ cpp file that initializes the UI and connects the one slot @ #include "EditToolImpl.h" #include <QColorDialog> #include "generated\ui_editToolDockWidget.h" EditToolImpl::EditToolImpl(QDockWidget& parent) { m_ui = new Ui::EditToolWidget(); m_ui->setupUi(&parent); QObject::connect(m_ui->colorToolButton, SIGNAL(clicked()), this, SLOT(colorToolButtonClicked())); } EditToolImpl::~EditToolImpl(void) { } void EditToolImpl::colorToolButtonClicked() { QColor color; color = QColorDialog::getColor(Qt::green, m_ui->dockWidgetContents, QString("Select Color"), QColorDialog::DontUseNativeDialog); } @ The command to compile the header file: $(SolutionDir)\ThirdParty\Qt\4.8.0\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"$(SolutionDir)\ThirdParty\Qt\4.8.0\include\QtCore" -I"$(SolutionDir)\ThirdParty\Qt\4.8.0\include\QtGui" -I"$(SolutionDir)\ThirdParty\Qt\4.8.0\include" -I"$(SolutionDir)\ThirdParty\Qt\4.8.0\include\ActiveQt" -I"." -I"$(SolutionDir)\ThirdParty\Qt\4.8.0\mkspecs\win32-msvc2010" -D_MSC_VER=1600 -DWIN32 EditToolImpl.h -o generated\moc_EditToolImpl.cpp Generated moc_EditToolImpl.cpp @ /**************************************************************************** ** Meta object code from reading C++ file 'EditToolImpl.h' ** ** Created: Tue Feb 7 19:19:52 2012 ** by: The Qt Meta Object Compiler version 63 (Qt 4.8.0) ** ** WARNING! All changes made in this file will be lost! *****************************************************************************/ #include "../EditToolImpl.h" #if !defined(Q_MOC_OUTPUT_REVISION) #error "The header file 'EditToolImpl.h' doesn't include <QObject>." #elif Q_MOC_OUTPUT_REVISION != 63 #error "This file was generated using the moc from 4.8.0. It" #error "cannot be used with the include files from this version of Qt." #error "(The moc has changed too much.)" #endif QT_BEGIN_MOC_NAMESPACE static const uint qt_meta_data_EditToolImpl[] = { // content: 6, // revision 0, // classname 0, 0, // classinfo 1, 14, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors 0, // flags 0, // signalCount // slots: signature, parameters, type, tag, flags 14, 13, 13, 13, 0x0a, 0 // eod }; static const char qt_meta_stringdata_EditToolImpl[] = { "EditToolImpl\0\0colorToolButtonClicked()\0" }; void EditToolImpl::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) { if (_c == QMetaObject::InvokeMetaMethod) { Q_ASSERT(staticMetaObject.cast(_o)); EditToolImpl *_t = static_cast<EditToolImpl *>(_o); switch (_id) { case 0: _t->colorToolButtonClicked(); break; default: ; } } Q_UNUSED(_a); } const QMetaObjectExtraData EditToolImpl::staticMetaObjectExtraData = { 0, qt_static_metacall }; const QMetaObject EditToolImpl::staticMetaObject = { { &QObject::staticMetaObject, qt_meta_stringdata_EditToolImpl, qt_meta_data_EditToolImpl, &staticMetaObjectExtraData } }; #ifdef Q_NO_DATA_RELOCATION const QMetaObject &EditToolImpl::getStaticMetaObject() { return staticMetaObject; } #endif //Q_NO_DATA_RELOCATION const QMetaObject *EditToolImpl::metaObject() const { return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; } void EditToolImpl::qt_metacast(const char _clname) { if (!_clname) return 0; if (!strcmp(_clname, qt_meta_stringdata_EditToolImpl)) return static_cast<void>(const_cast< EditToolImpl>(this)); return QObject::qt_metacast(_clname); } int EditToolImpl::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 1) qt_static_metacall(this, _c, _id, _a); _id -= 1; } return _id; } QT_END_MOC_NAMESPACE @ The crash occurs within the connect call indicating that the call to *EditToolImpl::metaObject() is returning NULL data.
  • [SOLVED] How to keep a context menu open

    5
    0 Votes
    5 Posts
    9k Views
    P
    Here is the solution - works like a charm. I install the following eventFilter on all QMenus @ def eventFilter(self, obj, event): if event.type() in [QtCore.QEvent.MouseButtonRelease]: if isinstance(obj, QtGui.QMenu): if obj.activeAction(): if not obj.activeAction().menu(): #if the selected action does not have a submenu #eat the event, but trigger the function obj.activeAction().trigger() return True return super(<my_class_name>, self).eventFilter(obj, event) @
  • 0 Votes
    4 Posts
    14k Views
    D
    I'm running under Qt Creator... I've created a variable QT_PLUGIN_PATH and it works... but I guess it's not the real problem, right? Because it should find my plugins at first, right?
  • Qt3---&gt;qt4 contentsHeight

    1
    0 Votes
    1 Posts
    938 Views
    No one has replied
  • QPixmapCache but for QMovies

    1
    0 Votes
    1 Posts
    960 Views
    No one has replied
  • Hiding the System Menu Icon of QMdiSubWindow

    5
    0 Votes
    5 Posts
    5k Views
    T
    If to use the null icon then the standard Qt icon will be set on the QMdiSubWindow. Author in opposite wants to hide it.
  • 'signal slot' v/s direct call

    4
    0 Votes
    4 Posts
    2k Views
    sierdzioS
    Better is the one which suits you more in a given situation. With signals, you can connect a slot on both C++ and QML side, with Q_INVOKABLE you are "tied" to C++. Both uses are, IMO, needed (at least I use them...).
  • [Solved]QString changing value

    11
    0 Votes
    11 Posts
    8k Views
    T
    Thanks for the remainder of the [at] function: used [] instead and it works. Must be better to read the docs. //T
  • Direct base ‘QObject’ inaccessible in ‘myClass’ due to ambiguity

    5
    0 Votes
    5 Posts
    20k Views
    M
    Inheriting QObject is not necessary, QThread already is one and provides all it's functionality. Simply change it to @ class myClass : public QThread { Q_OBJECT public: ... @ [EDIT: code formatting, Volker]
  • Elements of constructor get deleted by call from another class

    6
    0 Votes
    6 Posts
    3k Views
    L
    [quote author="basil_fawlty" date="1328568251"]So you are suggesting to use getters. I have never come across using getters in c++. It looks rather complicated. Maybe you could tell me a bit more how to create a getter.[/quote] It is nothing special. Just make your members private instead of public and add methods to get and set the value - like you did in your previous post. Your code works fine (apart from some slips of the pen in A #1 and B #17). glVertex3f() is called with the values specified in A::A(). So your error is either in the way you set up your OpenGL viewport or in code not shown here.
  • Autoadjusting a window by checking / unchecking a checkbox

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • [solved]Qt4.7 to Qt4.8 meet problems, Help!

    6
    0 Votes
    6 Posts
    6k Views
    G
    please click the edit button under the first post and add a [solved] to the topic. Thanks.
  • [SOLVED] Qt GUI in VST plug-in - clicking menu bar crashes the host

    2
    0 Votes
    2 Posts
    3k Views
    V
    The problem disappeared when I changed static link to framework link and compiled customized Qt frameworks.
  • QTreeWidget - changing the current view when adding/removing items

    2
    0 Votes
    2 Posts
    2k Views
    G
    Hi, without seeing what you exactly do ( by showing some coe) it is hard to say. In general, if you have a model and a view and you insert an item, AFAIK this works.