Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • Font Bitstream Charter in Thai Language doesn't scale it-self properly

    Unsolved
    4
    0 Votes
    4 Posts
    577 Views
    kshegunovK
    @Charan you need to set a layout to your widget. As it is currently it won't resize with the widget and so it doesn't adjust properly.
  • How to Create StandAlone App for Linux which include all required libs ?

    Unsolved
    4
    0 Votes
    4 Posts
    1k Views
    gde23G
    The problem when using the flag to ignore glibc version is that the application then wont run on systems, that have an older glibc version. So what you should do, if you really want to make it working on (mostly) any linux system out there is to build the project on a system with an old glibc version. If you just want to run it on your own machines where you know for sure, that you have a high enough version of glibc then you can just ignore the error.
  • Tracking project versions using QDebug

    Unsolved
    2
    0 Votes
    2 Posts
    193 Views
    JonBJ
    @AnneRanch A number of macros, including __FILE__, are defined for convenience by the C++ compiler, rather than being a Qt feature. See e.g. https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html. There are a number of posts out there to play with it if you want to pick out a segment from __FILE__. I don't know though whether Qt provides any macro for "the actual main project source folder in "application output" ". I kind of think not, but stand to be corrected. You could probably pass a -DSOMETHING=/path from the makefile --- which might know where the source folder is --- as an argument in your compilation line so that you can use the symbol in your source code. But that's more work.
  • how to call QVariant::convert

    Solved
    14
    0 Votes
    14 Posts
    1k Views
    JonBJ
    @J-Hilk Well, no, you/someone said earlier we don't need to modify the QVariant value input parameter. You/someone said value.toList() was OK on a const. But we ought verify it's convertible before doing so/to distinguish from convertible-but-empty list. So I just thought (untested): if (value.canConvert(QVariant::List)) setList(value.toList()); ? Oh, that's what you started with? Yeah I see, I read that link now. Well, toList() is not going to fail here after canConvert() :) Anyway, that wasn't really my amusement. It was calling toList() and then calling canConvert(), as far as I can see in order to fit it into a variable-defining if(. There's no big point here from me, I get now that the canConvert/convert() functions aren't the same as each other.
  • How to running logic after window and widget is shown up?

    Unsolved
    2
    0 Votes
    2 Posts
    271 Views
    JonBJ
    @callmejauhari Hi & welcome. Sorry you didn't get a helpful answer. You will have to explain a bit what you are trying to do. For one thing, you say I want to build non user interaction application but then you tell us you are using widgets/windows? You can set off a QProgressBar or a QSplashScreen to show early and then remove it when you are ready to proceed. You can also do logic work when, say, a widget/window is first opened/shown to the user, if that's what you want. But one thing you are unlikely to want is "multithreading". If at all possible, especially as a beginner, don't jump into threads. Qt is a naturally "asynchronous" framework, usually it's possible to do things without blocking the UI yet without creating your own threads. (I'm not saying there are not cases you might actually need a thread, just that you need a good reason if you do.) Anyway, as I said, to answer better we'd need some more detail about what you are trying to do when.
  • When ever i add button or checkbox or anything in any UI file form it doesn't appear

    Unsolved
    14
    0 Votes
    14 Posts
    2k Views
    M
    @JonB @Pl45m4 i do have multiple .ui file in the project but there is no dublicate ui file that have the same name but i've multiple .pro files and there are dublicate like Hospital-ClinicSoftware.pro.user.181918d.4.8-pre1 Hospital-ClinicSoftware.pro.user HospitalClinicSoftware.pro.user Hospital-ClinicSoftware HospitalClinicSoftware "**note this not .pro it's normal file have the same name**" but i'm sorry i don't what's uic build exactly doing to ui files and i can't post Compile Output Result because it's more than 32000 character this my .pro file code #------------------------------------------------- # # Project created by QtCreator 2018-12-24T22:54:39 # #------------------------------------------------- # QT += core gui sql greaterThan(QT_MAJOR_VERSION, 4): QT += widgets designer TARGET = HospitalClinicSoftware TEMPLATE += app lib libs # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 CONFIG += c++11 plugins plugin designer SOURCES += \ main.cpp \ mainwindow.cpp \ mainprocess.cpp \ mysqldatabase.cpp \ showingdata.cpp \ delgate.cpp \ profile3.cpp \ profile.cpp \ multipagewidget.cpp \ multipagewidgetplugin.cpp \ multipagewidgetcontainerextension.cpp \ multipagewidgetextensionfactory.cpp \ mysqldatabase.cpp HEADERS += \ mainwindow.h \ mainprocess.h \ showingdata.h \ delgate.h \ profile3.h \ profile.h \ multipagewidget.h \ multipagewidgetplugin.h \ multipagewidgetcontainerextension.h \ multipagewidgetextensionfactory.h \ mysqldatabase.h FORMS += \ mainwindow.ui \ mainprocess.ui \ showingdata.ui \ profile3.ui \ profile.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path += /opt/$${TARGET}/bin $$[QT_INSTALL_PLUGINS]/designer !isEmpty(target.path): INSTALLS += target DISTFILES += Edit: Thi's the part of uic in Compile Output 16:47:08: Running steps for project HospitalClinicSoftware... 16:47:08: Starting: "D:\Qt\5.15.1\mingw81_32\bin\qmake.exe" D:\HospitalClinicSoftware\HospitalClinicSoftware.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" Info: creating stash file D:\build-HospitalClinicSoftware-Desktop_Qt_5_15_1_MinGW_32_bit-Debug\.qmake.stash Project WARNING: CONFIG+=designer is deprecated. Use QT+=designer instead. Project WARNING: CONFIG+=designer is deprecated. Use QT+=designer instead. Project WARNING: CONFIG+=designer is deprecated. Use QT+=designer instead. 16:47:12: The process "D:\Qt\5.15.1\mingw81_32\bin\qmake.exe" exited normally. 16:47:12: Starting: "D:\Qt\Tools\mingw810_32\bin\mingw32-make.exe" -f D:/build-HospitalClinicSoftware-Desktop_Qt_5_15_1_MinGW_32_bit-Debug/Makefile qmake_all mingw32-make: Nothing to be done for 'qmake_all'. 16:47:13: The process "D:\Qt\Tools\mingw810_32\bin\mingw32-make.exe" exited normally. 16:47:13: Starting: "D:\Qt\Tools\mingw810_32\bin\mingw32-make.exe" -j2 D:/Qt/Tools/mingw810_32/bin/mingw32-make -f Makefile.Debug mingw32-make[1]: Entering directory 'D:/build-HospitalClinicSoftware-Desktop_Qt_5_15_1_MinGW_32_bit-Debug' D:\Qt\5.15.1\mingw81_32\bin\uic.exe ..\HospitalClinicSoftware\mainwindow.ui -o ui_mainwindow.h D:\Qt\5.15.1\mingw81_32\bin\uic.exe ..\HospitalClinicSoftware\mainprocess.ui -o ui_mainprocess.h D:\Qt\5.15.1\mingw81_32\bin\uic.exe ..\HospitalClinicSoftware\showingdata.ui -o ui_showingdata.h D:\Qt\5.15.1\mingw81_32\bin\uic.exe ..\HospitalClinicSoftware\profile3.ui -o ui_profile3.h D:\Qt\5.15.1\mingw81_32\bin\uic.exe ..\HospitalClinicSoftware\profile.ui -o ui_profile.h g++ -c -fno-keep-inline-dllexport -g -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PLUGIN -DQT_DESIGNER_LIB -DQT_UIPLUGIN_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQDESIGNER_EXPORT_WIDGETS -DQT_NEEDS_QMAIN -I..\HospitalClinicSoftware -I. -I..\Qt\5.15.1\mingw81_32\include -I..\Qt\5.15.1\mingw81_32\include\QtDesigner -I..\Qt\5.15.1\mingw81_32\include\QtUiPlugin -I..\Qt\5.15.1\mingw81_32\include\QtWidgets -I..\Qt\5.15.1\mingw81_32\include\QtGui -I..\Qt\5.15.1\mingw81_32\include\QtANGLE -I..\Qt\5.15.1\mingw81_32\include\QtSql -I..\Qt\5.15.1\mingw81_32\include\QtXml -I..\Qt\5.15.1\mingw81_32\include\QtCore -Idebug -I. -I..\Qt\5.15.1\mingw81_32\mkspecs\win32-g++ -o debug\main.o ..\HospitalClinicSoftware\main.cpp g++ -c -fno-keep-inline-dllexport -g -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_PLUGIN -DQT_DESIGNER_LIB -DQT_UIPLUGIN_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQDESIGNER_EXPORT_WIDGETS -DQT_NEEDS_QMAIN -I..\HospitalClinicSoftware -I. -I..\Qt\5.15.1\mingw81_32\include -I..\Qt\5.15.1\mingw81_32\include\QtDesigner -I..\Qt\5.15.1\mingw81_32\include\QtUiPlugin -I..\Qt\5.15.1\mingw81_32\include\QtWidgets -I..\Qt\5.15.1\mingw81_32\include\QtGui -I..\Qt\5.15.1\mingw81_32\include\QtANGLE -I..\Qt\5.15.1\mingw81_32\include\QtSql -I..\Qt\5.15.1\mingw81_32\include\QtXml -I..\Qt\5.15.1\mingw81_32\include\QtCore -Idebug -I. -I..\Qt\5.15.1\mingw81_32\mkspecs\win32-g++ -o debug\mainwindow.o ..\HospitalClinicSoftware\mainwindow.cpp
  • Set Path doesnt work ~ QFileSystemModel

    Solved
    2
    0 Votes
    2 Posts
    173 Views
    Pl45m4P
    @ELEMENTICY said in Set Path doesnt work ~ QFileSystemModel: i did all,but it still start from the Local (C:) (NOTE* openfolderproj is from a class,it is "C:/Users/" Because setRootPath does not change the (visible) root directory of your model. (stated in your first linked thread as well as here in the Qt documentation)
  • build error

    Unsolved
    2
    0 Votes
    2 Posts
    219 Views
    sierdzioS
    @janaki said in build error: this error What error?
  • How to use and event filter in a QTest instance (video player application)

    Unsolved
    4
    0 Votes
    4 Posts
    344 Views
    Pl45m4P
    @Brioche said in How to use and event filter in a QTest instance (video player application): I already have instancied Event Filter into my QtAV_Player class but I thought I had to do it again in my test function in order to install the Event filter to the right window/widget No. This might cause the issue. There is one ef installed on windowTest and one "global" (on your QApplication). Both seem to watch the same object. Debug to see what exactly happens and where your KeyEvent went. Installing a global event filter can also lead to performance issues. AVPlayer player = static_cast<AVPlayer>(parent()); Try not to be reliant on parent, especially when using qApp. Also, better use qobject_cast or dynamic_cast here.
  • Pop the current undo command (being run) in an undo stack

    Solved
    4
    0 Votes
    4 Posts
    729 Views
    M
    @JonB I used the if condition before pushing undo command into stack like this: void UndoHandler::createCommand( const QString & option ) { Command *command = new Command(option); // Check validity before pushing undo command into undo stack bool isValid = command->doubleCheck(); if (isValid) { m_undoStack->push(command); } else { delete command; } } Undo command has a new method to check the if condition: class Command : public QUndoCommand { // ... virtual void undo(); virtual void redo(); // ... // New method to check validity bool doubleCheck(); // ... Logic *m_logic; const QString m_option; } bool Command::doubleCheck() { return m_logic->doubleCheck(m_option); } void Command::redo() { // Redo method has to be modified accordingly } The if condition is inside a separate method in logic: bool Logic::doubleCheck(const QString option) { if ( /* some condition here */ ) return true; else return false; }
  • Mingw float-store flag?

    Solved
    8
    0 Votes
    8 Posts
    713 Views
    aha_1980A
    Hi @BD9a, you can do a full rebuild and look at the compiler flags in Creators Compile Output, or in the terminal if you build from there. Regards
  • Trying to learn QAxObject querySubObject Word Built in commands

    Unsolved
    2
    0 Votes
    2 Posts
    213 Views
    JonBJ
    @ivasija-evonem There isn't much to say for QAxObject itself, it's just an interface to ActiveX/Automation. You need to find what to do in Word/VBA by looking for examples of that outside of Qt. As for examples, I do assume you have Googled for QAxObject? What about https://stackoverflow.com/questions/27108153/excel-with-qt-find-number-last-filled-row, which is for Excel but shows the principles? Or Google for QAxObject Word, there are so many examples....
  • Qt OPC-UA: Problems with running Waterpump example

    Unsolved
    3
    0 Votes
    3 Posts
    407 Views
    M
    Hello, yes. I am using a Demo License for evaluation purposes. Thank you. I will do that.
  • Qt 3D Camera projection matrix

    Solved
    5
    0 Votes
    5 Posts
    991 Views
    B
    @Pl45m4 thank you very much. I will need to take some time to digest it properly but based on a quick skim that looks like it is very good information.
  • How to select only part of a text of QGraphicTextItem

    Solved
    3
    0 Votes
    3 Posts
    428 Views
    M
    I did not propagate the mousePressEvent. See here: https://forum.qt.io/topic/120951/ideal-way-to-show-markable-text-in-qgraphicsscene/4
  • Performance of QTreeView vs QPlainTextEdit for chat log/history

    Unsolved
    5
    0 Votes
    5 Posts
    518 Views
    G
    Hmm, it seems to be around 20-30%. Not great, but significantly better. Of course, now the messages are displaying the html tags as text and become very long. I imagine this could potentially hide an even better performance improvement as the longer strings are more complex to calculate, even for the default delegate? If that is the case, the paint and size hint methods, not the model, is probably the biggest performace drain.
  • QStyledItemDelagete DecorationAlignment Do Not Work

    Solved
    2
    2 Votes
    2 Posts
    341 Views
    D
    Hi everyone, I solved the problem. in_p_option->decorationSize plays key role in this. before centering alignment decoration size should be changed also. By code is like below. QTableView *p_table = dynamic_cast<QTableView *>(in_index.model()->parent()); in_p_option->decorationSize = QSize(p_table->columnWidth(in_index.column()),p_table->verticalHeader()->defaultSectionSize()); in_p_option->decorationAlignment = Qt::AlignCenter;
  • shadow build issue ?

    Unsolved
    2
    0 Votes
    2 Posts
    221 Views
    Christian EhrlicherC
    @AnneRanch said in shadow buidl issue ?: What is " skipping qmake step " telling me ? I really wonder what's so hard to understand when you read the complete line 'Configuration unchanged, skipping qmake step' I mean - the configuration is not changed, so qmake doesn't need to be executed.
  • QOpenGLShaderProgram - shader program is not linked

    Unsolved
    7
    0 Votes
    7 Posts
    4k Views
    A
    @AIN007 I have solved the problem,just enable QML debugging
  • This topic is deleted!

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