Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.5k Posts
  • QVideoFrame::map() only allows one call?

    Unsolved
    6
    0 Votes
    6 Posts
    578 Views
    C
    Still cannot post code "Post content was flagged as spam by Akismet.com" The code in the image gives me --- 1.1: map true isMapped true isWritable true --- 1.2: map true isMapped false isWritable false --- 2.0: map true isMapped true isWritable false --- 2.1: map false isMapped true isWritable false --- 2:2 map false isMapped false isWritable false Without any sleep() it does indeed work, but I mean in reality there is some delay between frames in a video, right? I feel there is a bug somewhere. [image: ee58c7dc-25af-4b1b-a392-9ae33ccea846.png]
  • QSettings Language

    Solved
    14
    0 Votes
    14 Posts
    1k Views
    PerdrixP
    @JonB Nothing to do with QSettings. It was a Unix locale issue. It turns out that the QSettings stuff was left there by the original developer of that code to allow testing without switching the language of his system. It mightily confused me ...
  • Modbus TCP Client Holding Registers Address on HMI

    Unsolved
    2
    0 Votes
    2 Posts
    262 Views
    aha_1980A
    Hi @Zeshan, at first you should clarify if you want to use Modbus TCP or MQTT, as these are two completely different protocols. Regards
  • Use Qt APIs with Swift 5.9 and the new C++ interoperability

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    B
    Here the examples of how to use CPP in Swift with XCode projects.
  • Image zoom widget using QGraphicsView

    Unsolved
    2
    0 Votes
    2 Posts
    410 Views
    R
    --bump--
  • QRect width and height confuses me

    Unsolved
    3
    0 Votes
    3 Posts
    290 Views
    Q
    @Christian-Ehrlicher thanks for replying. I've seen the document, but i don't understand why it's rendered like that. if i need a big rect contains a small image, did i should just do like this: QRect big(0,0,152,152); QRect small(1,1,150,150); painter.setPen(QPen(Qt::red,1)); painter.drawRect(0,0,big.width-1,big.height-1); painter.drawImage(1,1,small.width-1,small.height-1); // or // painter.drawImage(1,1,small.width,small.height); ??? width and height for drawRect and drawImage is not the same meaning? right?
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    10 Views
    No one has replied
  • Widgets doesn't fit to content after hiding

    12
    0 Votes
    12 Posts
    9k Views
    P
    I tried all sorts of things as well, searched all over, and eventually found this post https://stackoverflow.com/questions/68303194/why-adjustsize-doesnt-resize-mainwindow-in-qt In the end all that I needed to do was ui.centralWidget->adjustSize(); adjustSize(); When a widget was hidden, the window would resize to remove the unused space. When the widget was unhidden, the window and layout would resize to make space for the widget. This was done with Qt 6.5.5, but I would guess this would work with earlier versions as well.
  • Event filter for QtabWidget (PySide6)

    Solved
    3
    0 Votes
    3 Posts
    746 Views
    E
    Thank you so much ,it works that way ,on the other hand ,i dont limit the values because it is needed that way
  • Remove space between QChart in grid layout

    Unsolved
    1
    0 Votes
    1 Posts
    174 Views
    No one has replied
  • 0 Votes
    4 Posts
    464 Views
    JonBJ
    @nicker-player I know nothing about QML or QResource. But since you are using bool QResource::registerResource(const uchar *rccData, const QString &mapRoot = QString()) overload it tells you Warning: The data must remain valid throughout the life of any QFile that may reference the resource data. That means you cannot afford to delete the newed array at all, so long as it may be referenced, does it not? You would need to save the newed pointer and only delete it after you no longer need the resource. I only say this from the description of that overload. If you could use the bool QResource::registerResource(const QString &rccFileName, const QString &mapRoot = QString()) overload instead you would not have this issue --- presumably because that one keeps the file open and gets the data from there instead of requiring the data to be sitting in permanent memory?
  • This topic is deleted!

    Unsolved
    2
    0 Votes
    2 Posts
    61 Views
  • Help changing someone else's code (default window size)

    Unsolved
    5
    0 Votes
    5 Posts
    578 Views
    R
    There are items in this main window that I don't need and can't use anyway, and I found those components in a script named "CameraSettingsPage dot py." I was able to delete the "Save RAW and Meta data" item easily, so I saved a whole line of space there, but when I deleted code for the "Sensor mode" (which also seems to be unusable)... # センサモードのコンボボックス self.sensorFormat = QComboBox() #self.sensorFormat.addItem("Default") self.sensorFormat.addItems([f'{x["formatfsensor"].format} {x["size"]}' for x in picam2s[camid].sensor_modes]) # 最大の解像度(4608x2592)に設定 # プレビューとキャプチャの画角違い防止のため固定 self.sensorFormat.setCurrentIndex(2) self.sensorFormat.setEnabled(False) formLayout.addRow("センサーモード", self.sensorFormat) ...the program would no longer launch. I assume there are references to things in this code elsewhere in this script (or maybe other scripts) that I would also need to delete or modify. I also would like to get rid of the "Image Size" (画像サイズ) item just below the sensor mode item. # 画像サイズ反映ボタン self.resButton = QPushButton("反映") self.resButton.setEnabled(False) # 画像サイズ反映ボタンクリック時の動作 self.resButton.clicked.connect(self.on_resButton_clicked) # 画像の縦横サイズを変更時は反映ボタンを有効化 self.imageWidth.valueChanged.connect(lambda: self.resButton.setEnabled(True)) self.imageHeight.valueChanged.connect(lambda: self.resButton.setEnabled(True)) # 画像サイズ resolution = QWidget() resHLayout = QHBoxLayout() resolution.setLayout(resHLayout) resHLayout.addWidget(self.imageWidth) resHLayout.addWidget(QLabel("x"), alignment=Qt.AlignHCenter) resHLayout.addWidget(self.imageHeight) resHLayout.addWidget(QLabel(" "), alignment=Qt.AlignHCenter) resHLayout.addWidget(self.resButton) formLayout.addRow("画像サイズ", resolution) Getting rid of those two would make this window plenty usable and legible. (As it is, the "Rotation" control, just below the "Image size" control, is unusable with the window sized to fit my screen, because the button isn't visible.)
  • killTimer: Timers cannot be stopped from another thread

    Solved
    12
    0 Votes
    12 Posts
    2k Views
    S
    @DungeonLords said in killTimer: Timers cannot be stopped from another thread: void Worker::run() processEvents() in an infinite loop is not the best solution here. This will produce code that will use a single core a 100%. People will start asking questions why your app is using 100% of one core while it is doing nothing (I'm speaking from experience). The proper solution is to call exec() instead. However, this is also already the default implementation of QThread::run(). So, you can just leverage that and throw away your entire while-loop. Maybe then don't call your method run() but just createTimer(). Then it makes a lot more sense to call connect(thread.get(), &QThread::started, worker.get(), &Worker::createTimer());, i.e. createTimer when thread is started. (Instead of using requestInterruption you would then just call quit.) The use of exit_LABEL shows some lack of understanding of asynchronous programming, which is the natural way in Qt. Send signals connected to slots instead to perform such operations. Just out of curiosity: Was AI heavily involved in creating this code? Or are you just coming from embedded systems programming? emit GetTimeAsk(); does not make sense. emit is usually used for signals only (it compiles because it is replaced by nothing by the preprocessor). Effectively you are just executing a normal member function. This also means that this is just executed in the main thread. (Which in turn means that incrementing i is not thread safe.)
  • Problem with deleting QBuffer

    Solved
    18
    0 Votes
    18 Posts
    2k Views
    A
    @Pl45m4 said in Problem with deleting QBuffer: Simple: Link you release build to Qt release libs and your app's debug build to Qt's debug libs. Yes. Apparently I was linking external release libraries instead of debug ones. The issue is solved. Thank you!
  • Use QStandardItemModel with QTreeView

    Unsolved
    13
    0 Votes
    13 Posts
    3k Views
    Christian EhrlicherC
    @Scherer-Tech said in Use QStandardItemModel with QTreeView: how to connect the model to a QTreeView See https://doc.qt.io/qt-6/qabstractitemview.html#setModel and https://doc.qt.io/qt-6/model-view-programming.html
  • Modal Dialogs break Virtual Keyboard

    Solved
    7
    1 Votes
    7 Posts
    2k Views
    L
    Final Problem Solution: https://blog.csdn.net/qq_32854345/article/details/128022276
  • Menu bar does not show up in Mac Qml application after upgrading from Qt6.7.0 to 6.8.0

    Unsolved
    10
    0 Votes
    10 Posts
    1k Views
    M
    @IgKh Thank you very much. That makes a lot of sence. I agree that the previous behavior can be considered a defect. I wonder why I didn't notice that before, but I think I was happy that it looked the same on all 3 platforms
  • #include <ApplicationServices/ApplicationServices.h> is not working

    Unsolved
    9
    0 Votes
    9 Posts
    1k Views
    Usama HaiderU
    @Pl45m4 I understand your point but how hubstaff , timedoctor,tahometer these apps track user keyboard mouse and even screens activity on other apps
  • 0 Votes
    10 Posts
    2k Views
    JonBJ
    @papisant Well, I'm not sure why it did not work with your original m_mediaDevices{std::make_shared<QMediaDevices>(this) which would surely be a class member too. Anyway, the important take away from this is: when connecting a signal you must look at the scope/lifetime of the signalling object (same for the slot). If either of these is a "local variable" that means the object will go out of scope and be destroyed at the end of the function they are in. And when Qt sees either the signalling or slot object being destroyed it auto-disconnects any connected signals/slots for that object (for obvious reasons). A connection only persists as long as both signal & slot objects are in existence. That is why class members are often used, or the object must be newed and not deleted.