Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.5k Posts
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    3 Views
    No one has replied
  • Overriding QCustomPlot library method with your own method

    Unsolved
    12
    0 Votes
    12 Posts
    860 Views
    jsulmJ
    @lukutis222 Then add them in code
  • Undocumented automatic metatype registration in Qt6?

    Unsolved metatype signals & slots qvariant qt6
    6
    0 Votes
    6 Posts
    2k Views
    L
    @oblivioncth same here. Neither Macro nor register function needed. no related documents.
  • Facing issues after upgrading to qt 6.6

    Unsolved qtupgrade qt6
    1
    0 Votes
    1 Posts
    224 Views
    No one has replied
  • C++ Qt Widget app: catch mouse signals from a QPixmap?

    Solved
    3
    0 Votes
    3 Posts
    263 Views
    Pl45m4P
    @Tom-asso Search for "Clickable Label" or something. There is even an entry on Qt Wiki for that: https://wiki.qt.io/Clickable_QLabel Then you just have to use QLabel::setPixmap(yourPixmap) to assign the image to it. Edit: Usually there is no need to "new" a QPixmap. Using a stack variable is sufficient most of the time.
  • where can I change $(Qt_INCLUDEPATH_) meaning?

    Unsolved configuration macros
    3
    0 Votes
    3 Posts
    540 Views
    J
    @Pl45m4 Solution Explorer, right click on the project name -> Qt -> "Upgrade to latest Qt project format version". -- this is no longer an option on the Qt menu!! I have not been able to update Qt_INCLUDEPATH_!
  • Qt 5 + Gstreamer cannot connect to stream

    Solved
    7
    0 Votes
    7 Posts
    669 Views
    S
    @JoeCFD @JoeCFD I have found an Issue! I have used a port 5000 which is blocked on my machine, but only if the request comes not from terminal (No Idea how could it be... :) ). To find it I have used the native approach: #include <gst/video/videooverlay.h> #include <gst/gst.h> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); gst_init(NULL,NULL); // getting more information gst_debug_set_active(true); gst_debug_set_default_threshold(GST_LEVEL_INFO); GstElement *pipelineVideoIn = nullptr; GstStateChangeReturn ret; GstElement *source = nullptr; GstElement *capsfilter = nullptr; GstElement *rtpjpegdepay = nullptr; GstElement *jpegdec = nullptr; GstElement *videoconvert = nullptr; GstElement *sink = nullptr; GstCaps *caps; pipelineVideoIn = gst_pipeline_new("pipeline"); source = gst_element_factory_make("udpsrc", "source"); capsfilter = gst_element_factory_make("capsfilter", "capsfilter"); rtpjpegdepay = gst_element_factory_make("rtpjpegdepay", "rtpjpegdepay"); jpegdec = gst_element_factory_make("jpegdec", "jpegdec"); videoconvert = gst_element_factory_make("videoconvert", "videoconvert"); sink = gst_element_factory_make("qtvideosink", "sink"); gst_bin_add_many(GST_BIN(pipelineVideoIn), source, capsfilter, rtpjpegdepay, jpegdec, videoconvert, sink, nullptr); if (!gst_element_link_many(source, capsfilter, rtpjpegdepay, jpegdec, videoconvert, sink, nullptr)) { g_printerr("Elements could not be linked"); } g_object_set(source, "port", 5000, nullptr); caps = gst_caps_from_string("application/x-rtp, media=video, clock-rate=90000, encoding-name=JPEG, payload=96"); g_object_set(capsfilter, "caps", caps, nullptr); gst_caps_unref(caps); // get window handle WId xwinid = ui->videoWidget->winId(); // try to set overlay gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sink), xwinid); GstStateChangeReturn sret = gst_element_set_state (pipelineVideoIn, GST_STATE_PLAYING); } Unfortunately has this code an another problem, the overlay cannot be set :( and program crushes. But due to gst debug features, it is clear, that the gstreamer cannot connect the given address, because it is "already in use" [image: 551b6863-3000-4f35-8f29-96c748d73c94.png] And after changing of the port on both sides (source and sink), streaming start to work with old application! Ones Again, Thanks @JoeCFD for your Advice's!
  • sql query thread termination

    Unsolved
    4
    0 Votes
    4 Posts
    374 Views
    Christian EhrlicherC
    @Seb-Tur said in sql query thread termination: I do below if (!isInterruptionRequested()) emit queryExecutionFinished(results); // Emit the signal with the results You should do inside the query.next() when there are a lot of rows. but my question is how do I kill the thread stuck at the query.exec() ? simply exit the run() function.
  • QTemporaryFile Problems

    Solved
    20
    0 Votes
    20 Posts
    1k Views
    ModelTechM
    I found the problem! I needed to add the relavant Qt image format plugins to my deployable package... Thanks for all the help in directing me to an approach that enabled me to identify the actual problem :) :) :)
  • Graphics Preview of Custom Graphics Objects (not Standard Qt Quick Controls) in Qt 5

    Unsolved
    1
    0 Votes
    1 Posts
    118 Views
    No one has replied
  • add EXE Icon

    Solved icon exe executable
    9
    0 Votes
    9 Posts
    2k Views
    J
    @Bonnie said in add EXE Icon: Did you not make it? Yes I did now :) Thank you so much for your helping IDI_ICON1 ICON "Resources/images/myapp.ico" .rc file has been created by notepad set(APP_ICON_RESOURCE_WINDOWS "${CMAKE_CURRENT_SOURCE_DIR}/icon.rc") if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) qt_add_executable(MyApp MANUAL_FINALIZATION ${PROJECT_SOURCES} ${QM_FILES} ${APP_ICON_RESOURCE_WINDOWS} ... icon.rc )
  • Qt C++ Draw resizable Item

    Unsolved
    1
    0 Votes
    1 Posts
    173 Views
    No one has replied
  • qt app crashes on startup

    Solved
    2
    0 Votes
    2 Posts
    384 Views
    hskoglundH
    Hi, crashing in igd12um32xel.dll implies that your Intel Graphics video driver is old, try updating it.
  • Reproduce image watch

    Unsolved
    11
    0 Votes
    11 Posts
    703 Views
    Pl45m4P
    @Christian-Ehrlicher Not my topic ;-) I did that here, but OP still wants to create pixel graphic items at some point...
  • How to add tooltip to (main) menu item ?

    Moved Unsolved
    2
    0 Votes
    2 Posts
    269 Views
    A
    @AnneRanch UPDATE Adding BluetoothMenu_Terminal->setToolTipsVisible(true); to main menu code (!) makes submenu tool tips work correctly I am not convinced if there is a way to make the tool tip work on main menu. Hovering on main menu "pulls down " the submenus and that MAY be stopping / masking the main menu tool tip . I can check that (theory / guess ) by having menu with NO SUBMENUS.... QMenu *BluetoothMenu_Terminal = menuBar()->addMenu(tr("&Terminal ...")); // tool tip shows up in submenu ??? text = " primary parent menu access to terminal and its sub submenus "; BluetoothMenu_Terminal->setToolTip(text); BluetoothMenu_Terminal->setToolTipsVisible(true);
  • 0 Votes
    2 Posts
    776 Views
    bibasmallB
    I have found out that this problem is mainly related to WinAPI + framelessness, not to Qt. I didn't manage to find any working WinAPI solution, for example, I've tried this one: melak47's solution. So I've chosen Qt way. This approach is not as concise as I expected from the WinAPI approach, but it works. Here is a code snippet describing only the necessary parts. .hpp class FramelessWindow : public QQuickWindow { Q_OBJECT QML_ELEMENT Q_PROPERTY(bool isMaximized READ isMaximized NOTIFY isMaximizedChanged) signals: void isMaximizedChanged(); public: FramelessWindow() noexcept; Q_INVOKABLE void showNormal() noexcept; Q_INVOKABLE void showMaximized() noexcept; bool isMaximized() const noexcept; private: bool eventFilter(QObject* watched, QEvent* event) override; bool nativeEvent(const QByteArray& eventType, void* message, qintptr* result) override; QRect restoredGeometry_; bool isMaximized_; }; .cpp FramelessWindow::FramelessWindow() noexcept : isMaximized_ { false } { setFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::WindowMaximizeButtonHint); installEventFilter(this); SetWindowLongPtr((HWND)winId(), GWL_STYLE, WS_POPUP | WS_THICKFRAME | WS_CAPTION | WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX); } void FramelessWindow::showNormal() noexcept { setGeometry(restoredGeometry_); isMaximized_ = false; emit isMaximizedChanged(); } void FramelessWindow::showMaximized() noexcept { restoredGeometry_ = geometry(); setGeometry(screen()->availableGeometry()); isMaximized_ = true; emit isMaximizedChanged(); } bool FramelessWindow::isMaximized() const noexcept { return isMaximized_; } bool FramelessWindow::eventFilter(QObject* watched, QEvent* event) { QPoint cursorPos = QCursor::pos(); qreal dpr = devicePixelRatio(); QRect draggingArea = geometry(); draggingArea.setHeight(32 * dpr); draggingArea.setY(draggingArea.y() + dpr * ResizeBorderWidth); if (draggingArea.contains(cursorPos)) { if (event->type() == QEvent::MouseButtonPress) { if (isMaximized_) { restoredGeometry_.moveTo({ QCursor::pos().x() - restoredGeometry_.width() / 2, QCursor::pos().y() - 10 }); showNormal(); } startSystemMove(); return true; } else if (isResizable_ && event->type() == QEvent::MouseButtonDblClick) { if (draggingArea.contains(cursorPos)) { if (isMaximized_) { showNormal(); } else { showMaximized(); } return true; } } else if (event->type() == QEvent::WindowStateChange && QWindow::visibility() == QWindow::Maximized) { setGeometry(screen()->availableGeometry()); isMaximized_ = true; emit isMaximizedChanged(); return true; } } return QQuickWindow::eventFilter(watched, event); } bool FramelessWindow::nativeEvent(const QByteArray& eventType, void* message, qintptr* result) { if (auto* msg = static_cast<MSG*>(message); msg->message == WM_NCCALCSIZE) { NCCALCSIZE_PARAMS& params = *reinterpret_cast<NCCALCSIZE_PARAMS*>(msg->lParam); if (params.rgrc[0].top != 0) { --params.rgrc[0].top; } *result = 0; return true; } return QQuickWindow::nativeEvent(eventType, message, result); }
  • QTableview::selectAll() dosen't work correctly when under release mode

    Unsolved
    3
    0 Votes
    3 Posts
    187 Views
    JonBJ
    @qyy2024 What "crashes or errors"? "errors" print messages and "crashes" should give some kind of stack trace if run in a debugger? Why are you including <private/qtableview_p.h>, and what are the consequences if you are using internal, private methods?
  • Qprocess exiting with exit code 255 when trying to run python script

    Solved qprocess qt c++ python
    22
    0 Votes
    22 Posts
    7k Views
    AdithyaA
    Thanks guys it worked. python3 and readyReadStandardOutput(showed the log ,was expecting it to work like qDebig() and cout .My bad) . Sorry for bothering with wrong misconception.
  • time zone other than UTC and local in QDateTimeEdit

    Solved
    9
    0 Votes
    9 Posts
    3k Views
    C
    @agarvey said in time zone other than UTC and local in QDateTimeEdit: timezone is a valid QByteArray On my Ubuntu system timezone is (also) an external long int declared in time.h. Without declaring a QByteArray called timezone this statement: dte->setDateTime(time.toTimeZone(QTimeZone(timezone))); compiles happily here and becomes (in my UTC+10 TZ): dte->setDateTime(time.toTimeZone(QTimeZone(-36000))); which takes the time given to the date edit on a wild excursion. Make sure of what you are actually getting.