Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.2k Topics 455.4k Posts
  • Lib dependencies and QMake variables not changing when modified in a .pri function

    Unsolved
    7
    0 Votes
    7 Posts
    830 Views
    C
    Thank you guys for your feedback. Yes, I think the problem is probably in the Test function. I know that also Qt is switching to CMake, but I wonder if there is a temporary solution to fix this problem in some other way
  • Removed QLineEdit gets focus. Is this a bug?

    Unsolved
    5
    0 Votes
    5 Posts
    464 Views
    mrjjM
    @isar yes i also tried that but thought it was a bit overkill. Apparently update() is not enough always. My test was actually made in Designer and i just use textChange signal to see where i typed and it was easy to get same effect that setting focus back to Group after i hide widget1 would still focus the hidden line edit and type to it. So for me, it smells as a bug as hidden widgets should not get keyboard focus. And the GroupBox clearly set focus to a hidden lineedit. :)
  • 0 Votes
    2 Posts
    177 Views
    Christian EhrlicherC
    As you can see there is a difference. I would guess the content-length:0 comes from the empty QByteArray() you pass to the sendCustomRequest() function. Why the server behaves differently is out of our scope (and Qt's scope)
  • Project has reset to older version

    Unsolved
    8
    0 Votes
    8 Posts
    806 Views
    JonBJ
    @Komerad Since it's a hobby project, may I suggest you look at https://github.com/. This would allow you for free to maintain all the versions of your code you choose to deposit up on the ethercloud. Apart from giving you "free backup" of every version of your work, it also allows you to do things like compare new versions against old versions when you're trying to figure consequences of changes in your code. It's all integrated from within Qt Creator via Git/GitHub. If you are, say, Windows a little tutorial is https://cpb-us-w2.wpmucdn.com/u.osu.edu/dist/7/11881/files/2018/02/QtCreatorGitTutorial-2ahr2m0.pdf, or there are plenty of others around. It takes a few minutes to set up, but once you have done so you will want to use this always. At least then if for whatever reason you "lose" stuff again, like you're worried about and don't know why, you won't actually lose any work.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    20 Views
    No one has replied
  • 0 Votes
    6 Posts
    367 Views
    D
    Hi @mrjj , I try to understand on QImage. for now I have implemented it on QPicture and I don't know if you can capture the color type from QPicture functions. can you? yes it is true the complexity of understanding what type of design it is, I thought there is an easy way to capture the type of design. maybe if anyone knows how to do it. would be very helpful. thank you very much. I await other solutions
  • Windows desktop program development, how to add a menu on a button?

    Unsolved
    2
    0 Votes
    2 Posts
    235 Views
    L
    If this is what you need: [image: 1d71d407-19b9-499f-bd1a-1d6b87b29694.png] [image: f798902c-b218-4267-be06-4541b81a9f92.png]
  • Is it possible to use QMediaPlayer to send audio stream to another computer?

    Solved
    7
    0 Votes
    7 Posts
    399 Views
    JoeCFDJ
    @SGaist Great! That is what I need. Thank you so much.
  • TreeView - Wait until the drop is complete to perform another action

    Solved
    3
    0 Votes
    3 Posts
    403 Views
    F
    @VRonin You are a god. Finally I have finished the implementation thanks to your second option. I have tried (all possible combinations) and it works. I didn't know about Qt::QueuedConnection and the option to concatenate signals to the Qt event queue. This is going to be very useful to me. You have saved me and it is not the first time, I have seen your answers in other threads and they have helped me too. Thanks from Spain and sorry if my English is bad.
  • Where is surface "shininess" specified in these shaders?

    Solved opengl glshaders datavisualizati
    3
    0 Votes
    3 Posts
    627 Views
    W
    Yup, looks like you've spotted it -- in particular, the specular term is materialSpecularColor * lightStrength * pow(cosAlpha, 10) That's the part that will contribute to the shininess of the material. And, materialSpecularColor comes from highp vec3 materialSpecularColor = lightColor.rgb; which is to say that the materialSpecularColor in that shader is not really a property of the material since the value is just from the lighting. Not really the clearest name if you are trying to pick it apart. This type of look is traditionally used for a plastic type material which has white highlights for white lights regardless of the color of the material. If you want something a bit more metallic looking, you can multiply the lightcolor.rgb by some actual material color. This lighting model is a bit of an old school aphysical hack, so you may want to look into to more modern physically based lighting models if you are looking for more realism. But the classic specular + diffuse model is way simpler to understand even if it isn't super accurate to the real world.
  • Mac OS X: Camera Authentication from QT Creator very slow!

    Unsolved
    4
    0 Votes
    4 Posts
    440 Views
    SGaistS
    And The Qt version you are using in your Kit is also 5.14.2 ? By the way, do you have a minimal compilable examine that shows that behaviour ?
  • Accept from child dialog closes hidden parent dialog.

    Unsolved
    6
    0 Votes
    6 Posts
    423 Views
    I
    @SGaist On "Ok" button I have hide(); auto res = mSessionProgress->exec(); show(); On "Cancel" of Progress dialog I just have: connect(ui->btnCancel, &QPushButton::clicked, this, ={ accept(); });
  • Problem with scroll in Qlistwidget

    6
    0 Votes
    6 Posts
    4k Views
    G
    I have a QListWidget* in ui->barra_scroll and I feel very smooth with this... QScrollBar *qsb = ui->barra_scroll->verticalScrollBar(); qsb->setSingleStep(5);
  • Background color change not taking effect in QTreeView with stylesheet

    Solved
    12
    0 Votes
    12 Posts
    4k Views
    SGaistS
    Hi, Once you have Xcode installed, you can use macports or homebrew to install additional tools (or more recent versions of bash ;-)) Then you pretty much get the same feeling as on Linux. You have to change Ctrl for Cmd when you are outside of a terminal and then you should feel at home.
  • 0 Votes
    7 Posts
    2k Views
    mrjjM
    @IceMichael Hi. I have not seen any option for fakevim saying "use normal selection" so i dont think so. [image: 4jsLf4.png]
  • Using PinchArea and MouseArea on the Canvas element

    Unsolved
    1
    0 Votes
    1 Posts
    132 Views
    No one has replied
  • Delayed readReady signal of QSerialPort

    Solved
    14
    0 Votes
    14 Posts
    2k Views
    K
    but I would be interested in this answer also :) As I remember, we did some project where we do changes for FTDI latency parameter: #ifdef Q_OS_WIN // Возвращает указатель реестра для устройства с заданным именем, // если оно является последовательным портом FTDI, либо 0. HKEY openFtdiDeviceParameters(const QString &portName) { const wchar_t *keypath = L"SYSTEM\\CurrentControlSet\\Enum\\FTDIBUS"; HKEY key; if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, keypath, 0, KEY_READ, &key)) { // Порты FTDI отсутствуют. return 0; } // Просматриваем все порты FTDI. int idx = 0; HKEY readOnlyKey = 0; HKEY paramKey = 0; while (true) { if (paramKey) { RegCloseKey(paramKey); paramKey = 0; } DWORD subkeySize = 140; wchar_t subKey[140] = {0}; // Последовательный порт не является устройством FTDI. if (RegEnumKeyEx(key, idx++, subKey, &subkeySize, 0, 0, 0, 0)) { break; } QString paramPath(QString(QLatin1String("%1\\0000\\Device Parameters")).arg(QString::fromWCharArray(subKey))); if (RegOpenKeyEx(key, paramPath.toStdWString().c_str(), 0, KEY_READ, &readOnlyKey)) { continue; } DWORD regPortNameSize = 20; wchar_t regPortName[20] = {0}; DWORD type = 0; LONG result = RegQueryValueEx(readOnlyKey, L"PortName", 0, &type, (LPBYTE) &regPortName, &regPortNameSize); if (ERROR_SUCCESS == result) { QString name = QString::fromWCharArray(regPortName); if (portName == name) { RegOpenKeyEx(readOnlyKey, 0, 0, KEY_READ | KEY_SET_VALUE, &paramKey); } } RegCloseKey(readOnlyKey); if (paramKey) { break; } } RegCloseKey(key); return paramKey; } #endif and then: #ifdef Q_OS_WIN // Если выбранный порт является FTDI, устанавливаем его latency в 1. DWORD latency = 0; HKEY latencyKey = openFtdiDeviceParameters(name); DWORD dwType = 0; DWORD dwSize = sizeof(DWORD); bool foundFtdiDevice; if (latencyKey && !RegQueryValueEx(latencyKey, L"LatencyTimer", 0, &dwType, (LPBYTE) &latency, &dwSize) && dwType == REG_DWORD) { foundFtdiDevice = true; } else { foundFtdiDevice = false; } if (foundFtdiDevice) { if (latency != 1) { DWORD dwLatency = 1; RegSetValueEx(latencyKey, L"LatencyTimer", 0, REG_DWORD, (LPBYTE) &dwLatency, sizeof(DWORD)); RegCloseKey(latencyKey); } } #endif Here we did set the latency to 1 msec. PS: Sorry, all comments in russian (because it is copy-paste).
  • Run a command with different result between in QProcess and in terminal

    Solved
    12
    0 Votes
    12 Posts
    566 Views
    Pablo J. RoginaP
    @Mihan said in Run a command with different result between in QProcess and in terminal: I think it should be added in wiki. You're more than welcomed to do that!
  • Widgets are shrinked when added to scroll area

    Unsolved
    16
    0 Votes
    16 Posts
    2k Views
    K
    I've made the peace of code showing this behaviour a little simpler: import sys from PyQt5 import QtCore, QtGui, QtWidgets # Maybe you need to play with these constants PIXMAP_NUM = 1000 EVENTLOOP_RUN_NUM = 100 class Signals(QtCore.QObject): pixmaps = QtCore.pyqtSignal(list) class Worker(QtCore.QRunnable): def __init__(self): super().__init__() self.signals = Signals() @QtCore.pyqtSlot() def run(self): '''Make QPixmap object with different colours, add them to a list and emit the list''' c = QtGui.QColor colors = [c('red'), c('green'), c('blue'), c('cyan'), c('magenta'), c('yellow')] i = 0 pms = [] for _ in range(PIXMAP_NUM): pixmap = QtGui.QPixmap(200, 200) pixmap.fill(colors[i]) i += 1 if i == len(colors): i = 0 pms.append(pixmap) self.signals.pixmaps.emit(pms) class MyMainWindow(QtWidgets.QMainWindow): def __init__(self): super().__init__() self.setMinimumSize(QtCore.QSize(800, 600)) centralWidget = QtWidgets.QWidget() self.setCentralWidget(centralWidget) scrollArea = QtWidgets.QScrollArea() scrollArea.setWidgetResizable(True) imagesWidget = QtWidgets.QWidget() scrollArea.setWidget(imagesWidget) startButton = QtWidgets.QPushButton('Start') startButton.clicked.connect(self.run_worker) verticalLayout = QtWidgets.QVBoxLayout() verticalLayout.addWidget(scrollArea) verticalLayout.addWidget(startButton) centralWidget.setLayout(verticalLayout) self.imagesLayout = QtWidgets.QVBoxLayout() imagesWidget.setLayout(self.imagesLayout) def run_worker(self): threadpool = QtCore.QThreadPool.globalInstance() w = Worker() w.signals.pixmaps.connect(self.update_gui) threadpool.start(w) def update_gui(self, pixmaps): for i, img in enumerate(pixmaps): label = QtWidgets.QLabel() # The next line doesn't change the behaviour label.setMinimumSize(QtCore.QSize(200, 200)) label.setPixmap(img) self.imagesLayout.addWidget(label) # The next line doesn't change the behaviour self.updateGeometry() if i % EVENTLOOP_RUN_NUM == 0: QtCore.QCoreApplication.processEvents() if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) mw = MyMainWindow() mw.show() app.exec() This code reproduce the glitches on both the machines. I've noticed one thing. If we do not set the minimum size, label.setMinimumSize(QtCore.QSize(200, 200)) labels shrink. But if we do, they overlap (so, indeed, the minimum size is respected but imagesWidget is not big enough - cannot change its own size fast enough??? - to set the labels without overlapping???)
  • GCC Desktop Kit yellow mark on Linux

    Solved
    25
    0 Votes
    25 Posts
    2k Views
    Q
    @jsulm Thanks so much. Solved.