Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • Dependency order for output from bison & flex in pro file not working.

    Unsolved
    5
    0 Votes
    5 Posts
    542 Views
    SGaistS
    Could you provide a minimal example that shows that issue ?
  • How to seek video frame by frame with MediaPlayer

    Unsolved
    3
    0 Votes
    3 Posts
    668 Views
    W
    If frame-accurate seeking is important to you, there is a library called ffms2 that uses ffmpeg under the hood. It has an initial indexing pass when you first open a video which is a bit slow, but then it can seek to arbitrary frames reliably. Most API's designed for real time playback aren't good at seeking, just presenting whatever frames come through the pipeline as quickly as possible.
  • Disable API prior to 6.2 - no go

    Unsolved
    8
    0 Votes
    8 Posts
    466 Views
    Christian EhrlicherC
    You must not mix Qt libraries with different version. Especially you must not mix Qt5 and Qt6.
  • [Bug] QtQuick Design (Form Editor) completely blank

    Solved bug
    3
    0 Votes
    3 Posts
    833 Views
    D
    It turned out to be the same bug as described here: https://forum.qt.io/topic/124259/item-could-not-be-created/28 I followed the solution proposed there and with some tweaking of the Environment Kit I got it to work. Worked for me using Qt Desktop 5.15.1 MinGW 64-bit. Did NOT work with Qt Desktop 5.15.1 MSVS201x 64-bit. Have not tried version 6 (because of python conflicts with Pyside 2).
  • Minimum Size For qtreewidget columns

    Unsolved
    6
    0 Votes
    6 Posts
    3k Views
    A
    @JonB , @SGaist I found a bad hack, I know for sure this is not the correct way to program this feature but what I have done is whenever we resize a column a SIGNAL( sectionResized(index, oldSize, newSize) ) is emitted by header view class. I connected a SLOT (OnSectionResized(index, oldSize, newSize) ) void OnSectionResized(int index, int oldSize, int newSize) { Q_UNUSED(oldSize); if( index == FIRST_COLUMN_INDEX && newSize < FIRST_COLUMN_MIN_WIDTH ) { pTreeView->setColumnWidth(index, FIRST_COLUMN_MIN_WIDTH ); } } Any other workaround is much appreciated.
  • How use MYSQL on QT

    Unsolved qt 5.12 mysql plugin plugin install
    2
    0 Votes
    2 Posts
    1k Views
    Christian EhrlicherC
    @vin212 said in How use MYSQL on QT: MySql .................................. no ... I continue, i try this commande : nmake Why? As you can see qmake did not find your libs, so why do you think 'nmake' will do anything for mysql? As written in the documentation look into the logs and see why the libs were not found or usable.
  • Adding libraries in Qt with MSVC 2019 compiler

    Locked Unsolved
    3
    0 Votes
    3 Posts
    333 Views
    Christian EhrlicherC
    Dupe of https://forum.qt.io/topic/133740 - closed.
  • How to build a QT bluethooth music player

    Unsolved bluethooth music raspberry pi songs
    4
    0 Votes
    4 Posts
    2k Views
    raven-worxR
    @ElPadre no i dont couldnt find an example, but i think you can follow the mediaendpointconnector test implementation: https://github.com/KDE/bluez-qt/edit/master/tests/mediaendpointconnector.cpp
  • Show live data into a table

    Solved
    34
    0 Votes
    34 Posts
    6k Views
    M
    Thank you. Actually it didn't work. I try your advices, I'am searching for setting up the index, searching for the correct setup of the Widget parent, change the type for the second parameter value from QString to QVariant to int, also check if dataChanged() emits a signal (yes it does) - all that brings no change. The pasted data is shown in the view, but the parameter value doesn't update. And there is the fact that I can edit every cell of the table. And because the edited value are stored temporary I think that there is no problem with the index. I print the values that are changing to the console, and here I can see that the ouput react to the changes. Still confusing. Let me give you another example how I get the values (maybe there is an error): I have a method that reads the color values of the incoming video. With this values I do a calculation and after that I send the result with a signal to the QMainClass. redSum = CalculateAverageValue(redValues); greenSum = CalculateAverageValue(greenValues); blueSum = CalculateAverageValue(blueValues); emit SendRGBAverage(redSum, greenSum, blueSum); In the QMainClass I have a slot that stores the sended data into member variables.: void QVideoMeter::ReceiveRGBAverage(int redSum, int greenSum, int blueSum) { m_redSum = redSum; m_greenSum = greenSum; m_blueSum = blueSum; qDebug() << m_redSum << m_greenSum << m_blueSum; } The member variables I paste into the QAddTableItems() method, that is called inside QAddTableContent() void QVideoMeter::QAddTableContent() { QAddTableItems("Red", m_redSum ); } void QVideoMeter::QAddTableItems(const QString& parameter, int& value) { if (!m_tableDataModel->GetTableItem().contains({ parameter, value })) { m_tableDataModel->insertRows(0, 1, QModelIndex()); m_tableDataModel->setData(m_tableDataModel->index(0, 0, QModelIndex()), parameter, Qt::EditRole); m_tableDataModel->setData(m_tableDataModel->index(0, 1, QModelIndex()), value, Qt::EditRole); } else { QStopVideo(); } } But with this I get only the first transfered value, as I wrote above there is no update. On console I can see every change. When I debug the dataChanged() signal I can see the following: [image: y4mBF9eE54sLHa2xe6JRxh44QBniUq1YTn9UciBK4lCSVN0lE6mkRIxpBmMe8sZfdYG3VuBFmTkDHIORBDkwX4RpVgo6dySc_p0IJRPsKZxMjmW4vBQAJhwNL2db5xiw0J-nAhwqVqO2r-yfc013kq29XNOOzirCE1ntEfwCtY6N8TBPIusz9Q2UU2hI8uMYXjo?width=1024&height=164&cropmode=none] I'am wondering about the values of the index and also about the value of m_value, because 0 is not the value the program start with. Is there an error? This is my first big programming project. Please be kind.
  • Disable nagle's algorithm (TCP_NODELAY) using QWebSocket

    Unsolved
    1
    0 Votes
    1 Posts
    357 Views
    No one has replied
  • malloc_consolidate(): unaligned fastbin chunk detected

    Unsolved c++ qt qapplication
    6
    0 Votes
    6 Posts
    10k Views
    J
    See https://bugreports.qt.io/browse/QTCREATORBUG-26918
  • Using AlwaysActivateWindow to gain foreground in WIN10 using QT6.2

    Solved
    3
    0 Votes
    3 Posts
    1k Views
    S
    Thanks @Bonnie ! It worked out of the box. Only thing i needed (for the record, if fellow googlers end up here) as i use CMake based build system was to add include_directories(${Qt6Gui_PRIVATE_INCLUDE_DIRS}) And due compiling flags (warnings as errors): #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpedantic" #include <private/qguiapplication_p.h> #pragma GCC diagnostic pop Again for the record, the warning - suppressed by the above - was: In file included from C:/QT/6.3.0/mingw_64/include/QtCore/6.3.0/QtCore/private/qobject_p.h:64, from C:/QT/6.3.0/mingw_64/include/QtCore/6.3.0/QtCore/private/qcoreapplication_p.h:63, from C:/QT/6.3.0/mingw_64/include/QtGui/6.3.0/QtGui/private/qguiapplication_p.h:59, from C:/msys64/home/salmenrinne/pxr-studio/src/main/main.cpp:188: C:/QT/6.3.0/mingw_64/include/QtCore/6.3.0/QtCore/private/qproperty_p.h:263:16: error: ISO C++ prohibits anonymous structs [-Wpedantic] 263 | struct { | ^
  • QListWidget selection, preventing selection and revert to previous?

    Solved
    10
    0 Votes
    10 Posts
    2k Views
    S
    @SPlatten said in QListWidget selection, preventing selection and revert to previous?: Thinking about this issue, I think I will change the approach and when any of the controls are edited I will disable the list widget until the any changes have been submitted. You don't have to fully disable the list widget (which is when it is grayed out), but just blockSignals for the list widget. If I'm not mistaken I always go through the model to tweak the selection. This is the only way I have found so far to work properly.
  • This topic is deleted!

    Unsolved
    4
    0 Votes
    4 Posts
    144 Views
  • QT Chart UI Lag

    Unsolved
    4
    0 Votes
    4 Posts
    432 Views
    jsulmJ
    @MikeJO said in QT Chart UI Lag: Now the signal is constantly being fired as the updates are rapidly being received Then do not emit the signal on each update. Accumulate several updates and then emit them as one signal...
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    14 Views
    No one has replied
  • QAbstractTableModel Q

    Unsolved
    2
    0 Votes
    2 Posts
    177 Views
    I
    @IknowQT said in QAbstractTableModel Q: void wSpectrum::InitTableWidget() { QList<QPair<QString, QList<qreal>>> lstTemp; QPair<QString, QList<qreal>> pairTemp; pairTemp.first = "WaveLength"; pairTemp.second = m_pSpectrumInfo->GetWaves(); lstTemp.append(pairTemp); QPair<QString, QList<qreal>> pairTemp1; pairTemp1.first = "Data"; pairTemp1.second.append(2.123); pairTemp1.second.append(1.9052); pairTemp1.second.append(2.0935); pairTemp1.second.append(5.29804); pairTemp1.second.append(4.712890); pairTemp1.second.append(3.132087); lstTemp.append(pairTemp1); m_pModel = new usrTableModel(lstTemp); this->ui.tableWidget->setModel(m_pModel); auto xAixs = std::minmax_element(lstTemp[0].second.begin(), lstTemp[0].second.end()); m_pChart->axisX()->setRange(*xAixs.first, *xAixs.second); xAixs = std::minmax_element(lstTemp[1].second.begin(), lstTemp[1].second.end()); m_pChart->axisY()->setRange(*xAixs.first, *xAixs.second); QValueAxis* axisx = qobject_cast<QValueAxis*>(m_pChart->axes(Qt::Horizontal).first()); axisx->setTickCount(m_pSpectrumInfo->GetWaves().count()); QLineSeries* pSeries = new QLineSeries(m_pChart); QVXYModelMapper* mapper = new QVXYModelMapper(this); mapper->setXColumn(0); mapper->setYColumn(1); mapper->setSeries(pSeries); mapper->setModel(m_pModel); m_pChart->addSeries(pSeries); //AddChartSeries(); // [테스트] QPair<QString, QList<qreal>> pairTemp2; pairTemp2.first = "Data"; pairTemp2.second.append(1.123); pairTemp2.second.append(2.2052); pairTemp2.second.append(3.3935); pairTemp2.second.append(4.49804); pairTemp2.second.append(5.512890); pairTemp2.second.append(6.6132087); m_pModel->AppendData(pairTemp2); QLineSeries* pSeries1 = new QLineSeries(m_pChart); QVXYModelMapper* mapper1 = new QVXYModelMapper(this); mapper1->setXColumn(2); mapper1->setYColumn(3); mapper1->setSeries(pSeries1); mapper1->setModel(m_pModel); m_pChart->addSeries(pSeries1); //AddChartSeries(); } [image: 55e2fb57-8ad6-4cc3-a3f1-ea3b925a5cb8.png] The line series of the first data is drawn normally. The second data line is not drawn. When the model changes, the chart must also be updated. I wonder how. =================================================================== QLineSeries* pSeries = new QLineSeries(m_pChart); QVXYModelMapper* mapper = new QVXYModelMapper(this); mapper->setXColumn(0); mapper->setYColumn(1); mapper->setSeries(pSeries); mapper->setModel(m_pModel); m_pChart->addSeries(pSeries); //AddChartSeries(); // [테스트] QPair<QString, QList<qreal>> pairTemp2; pairTemp2.first = "Data"; pairTemp2.second.append(1.123); pairTemp2.second.append(7.2052); pairTemp2.second.append(4.3935); pairTemp2.second.append(3.49804); pairTemp2.second.append(1.512890); pairTemp2.second.append(2.6132087); m_pModel->AppendData(pairTemp2); QLineSeries* pSeries1 = new QLineSeries(m_pChart); QVXYModelMapper* mapper1 = new QVXYModelMapper(this); mapper1->setXColumn(0); mapper1->setYColumn(2); mapper1->setSeries(pSeries1); mapper1->setModel(m_pModel); m_pChart->addSeries(pSeries1); I set the Column of the first series mapper to 0, 1. I set the Column of the second series mapper to 0, 2. Then it prints normally. I didn't fully understand the function of setXColumn. What function does it specifically do? I've looked at the documentation, but I don't understand.
  • QTableview change number

    Unsolved
    11
    0 Votes
    11 Posts
    815 Views
    I
    @IknowQT said in QTableview change number: @IknowQT said in QTableview change number: @Christian-Ehrlicher @JonB I will post the code. void wSpectrum::InitTableWidget() { QList<QPair<QString, QList<qreal>>> lstTemp; QPair<QString, QList<qreal>> pairTemp; pairTemp.first = "WaveLength"; pairTemp.second = m_pSpectrumInfo->GetWaves(); lstTemp.append(pairTemp); lstTemp.append(pairTemp); m_pModel = new usrTableModel(lstTemp); this->ui.tableWidget->setModel(m_pModel); //m_pModel->AppendData(lstTemp); //this->ui.tableWidget->setModel(m_pModel); } ================ AbstrectTableModel ================== int usrTableModel::rowCount(const QModelIndex& parent) const { Q_UNUSED(parent) return m_lstInputData[0].second.count(); } int usrTableModel::columnCount(const QModelIndex& parent) const { Q_UNUSED(parent) return m_lstInputData.count(); } QVariant usrTableModel::headerData(int section, Qt::Orientation orientation, int role) const { //section: 행 Index if (role != Qt::DisplayRole) return QVariant(); if (orientation == Qt::Horizontal) { if (m_lstInputData.count() != 0 ) return m_lstInputData[section].first; } else return QString("%1").arg(section + 1); } void usrTableModel::SetheaderName(QString strTitle) { m_strTitle = strTitle; } QVariant usrTableModel::data(const QModelIndex& index, int role) const { if (role == Qt::DisplayRole) { if (m_lstInputData.count() != 0) return m_lstInputData[index.column()].second.at(index.row()); //return m_lstInputData[index.column()].second->at(index.row()); } else if (role == Qt::TextAlignmentRole) { return Qt::AlignCenter; } else if (role == Qt::EditRole) { return m_lstInputData[index.column()].second.at(index.row()); } return QVariant(); } bool usrTableModel::setData(const QModelIndex& index, const QVariant& value, int role) { if (index.isValid() && role == Qt::EditRole) { m_lstInputData[index.column()].second.replace(index.row(), value.toDouble()); emit dataChanged(index, index); return true; } return false; } Qt::ItemFlags usrTableModel::flags(const QModelIndex& index) const { return QAbstractItemModel::flags(index) | Qt::ItemIsEditable; } void usrTableModel::SetRowData(const QList< QPair<QString, QList<qreal>> >& data) { m_lstInputData = data; } void usrTableModel::AppendData(const QList<QPair<QString, QList<qreal>>>& data) { m_lstInputData.append(data); } If you setModel after appending the same data, two data will appear in TableView normally. I want to append data at different points in time. So I appended, but the appended data does not appear in TableView. When data is updated in Qlist, I want to automatically update TableView as well. void usrTableModel::AppendData(const QList<QPair<QString, QList<qreal>>>& data) { QModelIndex a = QModelIndex(); beginInsertColumns(QModelIndex(), m_lstInputData.count(), 1); m_lstInputData.append(data); endInsertColumns(); } I tried to do this, but the value of QModelIndex comes out as -1. void usrTableModel::AppendData(const QPair<QString, QList<qreal>>& data) { m_lstInputData.append(data); int nNewCol = this->columnCount(); beginInsertColumns(QModelIndex(), nNewCol, nNewCol); endInsertColumns(); QModelIndex a = QModelIndex(); QModelIndex index = createIndex(m_lstInputData[0].second.count(), m_lstInputData.count()); emit dataChanged(index, index); } I implemented it like this and it prints normally.
  • REPOST Linker problem

    Unsolved
    6
    0 Votes
    6 Posts
    1k Views
    C
    I gave you that "sermon" because you failed to describe the behaviour you were trying to achieve, leaving the forum to guess what you were doing. I made an educated guess which apparently you thought was beneath you. However, rather than actually engage with attacking the problem by providing adequate information you simply went quiet and started another thread. This thread still contains inadequate information. Give me some credit , You earn credit. work with what I and you have , Which as has been pointed out at least twice is inadequate to even start. and address the issue. You first. Post your PRO file. Tell us what environment you are working in. Post the entire compiler linker output.
  • symbols: DSO missing from command line??

    Unsolved
    2
    0 Votes
    2 Posts
    2k Views
    C
    @AnneRanch said in symbols: DSO missing from command line??: Why is /home/qy/Qt/5.12.12/gcc_64/lib/libQt5Widgets.so.5 library being used ? At compile time, because you still have a reference to the old libraries in your make files etc. At run time, because an executable/library linked against that file is being loaded and trying to load it. Sometimes because of a fallback path built into the library and sometime because it appears in LD_LIBRARY_PATH. Better yet, how do I fix it ? Specifically, by doing a fully clean build and making sure your run time environment is what you think. In general, by describing the problem adequately and then working the problem methodically. :-1: error: /home/qy/Qt/5.12.12/gcc_64/lib/libQt5Widgets.so.5: error adding symbols: DSO missing from command line OK, that error is gone...pretty normal , errors just pile up with ONE goof... OK, I am panicking , I cannot get pass "main"... So now you are saying you do not have this issue i.e. the one in the subject line. So what issue do you have? I do not mind errors , most of them are fixable , but this intermittent weird errors are driving me nuts. You are not alone. Should I look into different OS ? No. Thrashing about hoping for a random resolution without ever understanding the mode of failure is not a good strategy. 11:48:57: Starting /home/qy/Qt/Examples/Qt-5.12.12/widgets/mainwindows/mdi/mdi... terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc 11:48:58: /home/qy/Qt/Examples/Qt-5.12.12/widgets/mainwindows/mdi/mdi crashed. The error message clearly comes from a Qt 5 example, yet your post claims, "I just changed my entire project to 6.2.2." Are you debugging your code? The program has attempted a memory allocation (operator new or operator new[] directly or indirectly ) that failed. Trying to allocate a 5GB block on a 32-bit machine, trying to allocate a 128MB block on a machine with only 64MB of RAM, trying to allocate a block bigger than the largest available free space in memory, loading binary incompatible libraries ... all possibilities. Even the Qt code you posted gives a clue. It mentions Q_CHECK_PTR which you can trivially find with a Google search. This is a defence mechanism against the unforeseen, not a problem in itself. Cannot see your code, cannot help you fix your code When the program crashes in your debugger you get a stack backtrace. Read down the list of calls (i.e from most recent function call to least) until you find the first line in your code that triggered the memory allocation issue. Start there, asking yourself how could this fail?