Quantcast
Channel: General and Desktop
Viewing all 60131 articles
Browse latest View live

[[qanda:topic_unsolved]] Crash when using QKeySequence as global constant

$
0
0

Following program crashes:

#include <QtGui/qkeysequence.h>

inline const QKeySequence my_key_sequence = Qt::CTRL + Qt::Key_E;
inline const QKeySequence my_other_key_sequence = QKeySequence::Copy;

int main() {}

Why does it crash and how do I get around this?


[[qanda:topic_unsolved]] QLabel->setScaledContents() does not work

$
0
0

Hello friends, I have the following code:

#include "dialog.h"
#include "ui_dialog.h"
#include <QMessageBox>
#include <QFileDialog>
Dialog::Dialog(QWidget *parent)
  : QDialog(parent)
  , ui(new Ui::Dialog)
{
  ui->setupUi(this);

}

Dialog::~Dialog()
{
  delete ui;
}


void Dialog::on_toolButton_clicked()
{
  QString fileName=QFileDialog::getOpenFileName(this,"Abrir imagenes",
                                                QDir::rootPath(),"Imagenes (*.jpg *.jpeg *.png)");
  if(fileName.isEmpty())
    {
      return;
    }
  ui->label->setPixmap(QPixmap(fileName));
  ui->label->setScaledContents(true);

}

what I want is that when loading an image in the QLabel it adjusts to the size of the control but it doesn't work, I already put it in the constructor but it didn't work either; I tried to mark the property in the graphic designer but nothing, I would like to know why it is not working.

[[qanda:topic_unsolved]] QList.removeAt(int index) removes wrong item

$
0
0
You should check what index you pass to removeRow() - I would guess you're passing a wrong one there. QList::removeAt() is for sure removing the correct one (== the index you're passing in)

[[qanda:topic_unsolved]] 'No rule to make target' after upgrading Qt on mac

$
0
0
@kitfox delete the whole Build directory by hand and than rebuild the project Simply calling clean and rebuild is not enough after an xcode/osx update

[[qanda:topic_unsolved]] Cross compile Could not find feature concurrent.

$
0
0

Hi All,

I'm trying to make a cross compiled Qt.

But when I run the configure I get the following error:

with the following arguments:
./configure -device armadaxp --device-option=CROSS_COMPILE=/usr/local/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi- -sysroot /usr/local/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sysroot -no-opengl -opensource -confirm-license -nomake examples -nomake tests

Qt will be installed into '/usr/local/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sysroot/usr/local/Qt-5.12.5'.

Prior to reconfiguration, make sure you remove any leftovers from
the previous build.

/home/osboxes/qtbase/mkspecs/features/qt_docs_targets.prf:31: 'prepareRecursiveTarget' is not a recognized test function.
/home/osboxes/qtbase/mkspecs/features/qt_docs_targets.prf:31: 'prepareRecursiveTarget' is not a recognized test function.
/home/osboxes/qtbase/mkspecs/features/qt_docs_targets.prf:31: 'prepareRecursiveTarget' is not a recognized test function.
/home/osboxes/qtbase/mkspecs/features/qt_docs_targets.prf:31: 'prepareRecursiveTarget' is not a recognized test function.
/home/osboxes/qtbase/mkspecs/features/qt_docs_targets.prf:31: 'prepareRecursiveTarget' is not a recognized test function.
/home/osboxes/qtbase/mkspecs/features/qt_docs_targets.prf:31: 'prepareRecursiveTarget' is not a recognized test function.
/home/osboxes/qtbase/mkspecs/features/qt_docs_targets.prf:31: 'prepareRecursiveTarget' is not a recognized test function.
/home/osboxes/qtbase/mkspecs/features/qt_docs_targets.prf:31: 'prepareRecursiveTarget' is not a recognized test function.
/home/osboxes/qtbase/mkspecs/features/qt_docs_targets.prf:31: 'prepareRecursiveTarget' is not a recognized test function.
/home/osboxes/qtbase/mkspecs/features/testcase_targets.prf:4: 'prepareRecursiveTarget' is not a recognized test function.
/home/osboxes/qtbase/mkspecs/features/testcase_targets.prf:13: 'prepareRecursiveTarget' is not a recognized test function.

And when I try to make:

osboxes@osboxes:~/qtbase$ make
cd src/ && ( test -e Makefile || /home/osboxes/qtbase/bin/qmake -o Makefile /home/osboxes/qtbase/src/src.pro ) && make -f Makefile 
Project ERROR: Could not find feature concurrent.
make: *** [Makefile:51: sub-src-make_first] Error 3

Does anyone has an idea what i'm doing wrong?

[[qanda:topic_unsolved]] I can't understand the new syntax of connect

$
0
0

The definition of connect is as below:

inline QMetaObject::Connection QObject::connect(const QObject *asender, const char *asignal,
                                            const char *amember, Qt::ConnectionType atype) const
{ return connect(asender, asignal, this, amember, atype); }

And I can't understand how it work like

connect(new QSpinBox, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), [=](auto v){});

Why function pointer and lambda function can convert to

const char *

?

[[qanda:topic_unsolved]] How to Serialize SQL Result

$
0
0
Hi If by easy, you mean less code, i think QDataStream might be the winner. Like QByteArray block; QDataStream out(&block, QIODevice::WriteOnly); while (query.next()) { for all cols // not right syntax. ;) out << query.value(col) } What do you need the data for on the other side ? This will basically send it as a stream of variants. The Other side must know the types to convert to. You can send as concrete types if you wish.

[[qanda:topic_solved]] Can a top level item have a checkbox?

$
0
0
@SRaD You are welcome. Good luck.

[[qanda:topic_unsolved]] create tablet application and avoid rotation using qtwidget

$
0
0
thank you guys for the notes. I usually use Qt directly to test the applicaiton on the table. So far, i know when the application is finished, i convert it to xcode and inside it, i can plug the info file. Is there an easier way to use info.plist files from inside Qt ?

[[qanda:topic_unsolved]] stdlib.h not found

$
0
0
@taku-s looks like your toolchain has a setup problem. Are you cross compiling or directly on the PI? Which toolchain are you using? Regards

[[qanda:topic_unsolved]] QTreeWidgetItem: Modifying separation between item columns

$
0
0
Hi Im don't think its possible to get columns to start in different positions pr row outside of creating a new view. However, you could use a Delegate and handling the text painting yourself and draw it as shown using the data from the model It could even allow editing if done correctly.

[[qanda:topic_unsolved]] Adding text to same row, but next column?

$
0
0
Are y looking for QTreeWidgetItem::child()?

[[qanda:topic_unsolved]] Highlighting text in a QTextBrowser

$
0
0

I am implementing a search function for my help viewer based on QTextBrowser. What I would like to do, once a page has been loaded containing the search item text, is to highlight each of the occurrences of the text with background color = yellow. The user can then reload the document (hitting F5 calls the widget's reload() function) to remove the highlighting.

It appears that I can fetch the text block from the QTextDocument and the corresponding QTextFormat easily enough, but it seems that there is no way to edit it (i.e., change the background color of a selection)?

What would be the best way to implement this?

[[qanda:topic_unsolved]] QT ScrollBars doesn't appear with scrollAreaWidgetContents

$
0
0
I know this is an old thread but I just want to chip in to this. I got this exact problem trying to put anything into a QScrollBar in designer and they just don't work because of this stupid dummy "scrollAreaWidgetContents" that was auto created. It cannot be modified or deleted. The only workaround I found is to do everything in the main cpp, creating the image label and adding it to the QScrollArea object, skipping the scrollAreaWidgetContents, which completely took away the convenience of using the designer.

[[qanda:topic_unsolved]] missing path to "include"

$
0
0
Why moving the header file to local folder ? Sorry, I didn't say you should move anything. I wrongly assumed this was a file of your project. If it's not then that's fine. You don't have to move anything. Is Qt allergic to standard ways? What do you mean by that? The only Qt part in this process is usage of qmake and all it does is pass whatever you give it to the compiler. Can you be more specific what is non-standard here and what standard do you mean? There must be something else I am missing which is causing this Sorry, I'm lost. Which is causing what? If you include one file from the other you have to pass either full or relative path between them. If you want to use just a file name in include you have to pass an include path for that file directly to the compiler (which is done via INCLUDEPATH in qmake). There's nothing Qt specific about this. This is how C++ compilers work.

[[qanda:topic_unsolved]] how to add more than one characteristic to one service in bluetooth low energy

$
0
0

I have the following code example, which works fine and makes one characteristic to one service. I need to add a second characteristic ipData

  QLowEnergyAdvertisingData leAdd;
    leAdd.setDiscoverability(QLowEnergyAdvertisingData::DiscoverabilityGeneral);
    leAdd.setLocalName("SensorServer");
    leAdd.setIncludePowerLevel(true);

    QList<QBluetoothUuid> servicesList;
    servicesList.append(QBluetoothUuid::EnvironmentalSensing);
    leAdd.setServices(servicesList);

    QLowEnergyCharacteristicData chData, ipData;
    chData.setUuid(QBluetoothUuid::TemperatureMeasurement);
    chData.setValue(QByteArray(21,0)); //reset all the characteristic field
    chData.setValueLength(2,21); //length of the characteristic from 2 to 21 bytes - maximum character length of a characteristics
    chData.setProperties(QLowEnergyCharacteristic::WriteNoResponse | QLowEnergyCharacteristic::Write);
    const QLowEnergyDescriptorData descriptorData(QBluetoothUuid::ClientCharacteristicConfiguration, QByteArray(2, 0));
    chData.addDescriptor(descriptorData);

//    ipData.setUuid(QBluetoothUuid::WeightScale);
//    ipData.setValue(QByteArray(21,0)); //reset all the characteristic field
//    ipData.setValueLength(2,21); //length of the characteristic from 2 to 21 bytes - maximum character length of a characteristics
//    ipData.setProperties(QLowEnergyCharacteristic::Read);
//    const QLowEnergyDescriptorData ipdescriptorData(QBluetoothUuid::ClientCharacteristicConfiguration, QByteArray(2, 0));
//    ipData.addDescriptor(ipdescriptorData);


    QLowEnergyServiceData serviceData;
    serviceData.setUuid(QBluetoothUuid::Temperature);
    serviceData.setType(QLowEnergyServiceData::ServiceTypePrimary);
    serviceData.addCharacteristic(chData);

//    serviceData.setUuid(QBluetoothUuid::WeightScale);
//    serviceData.setType(QLowEnergyServiceData::ServiceTypeSecondary);
//    serviceData.addCharacteristic(ipData);


    controller = QLowEnergyController::createPeripheral();
    connect(controller, 

    QLowEnergyService *service = controller->addService(serviceData);
    QLowEnergyCharacteristic characteristic = service->characteristic(QBluetoothUuid::TemperatureMeasurement);
//    QLowEnergyCharacteristic characteristic1 = service->characteristic(QBluetoothUuid::WeightScale);


When i added the second service ipData, i don't get it in my mobile.
where is my mistake ?

[[qanda:topic_unsolved]] Creating a QGraphicsTextItem that "follows" a QGraphicsItem

$
0
0

I don't if there is already a function for this, but what i want to do is:

when i click on the diagramscene i want it to add 2 items, one QGraphicsSvgItem and one QGraphicsTextItem, but here is the deal, when i drag and drop my QGraphicsSvgItem i want the QGraphicsTextItem to keep it up with position, kind of following him, in a same position towards the QGraphicsSvgItem.

How can I do this?

[[qanda:topic_unsolved]] How to implement a simultaneous file editing?

$
0
0

Hey!

I just started using Qt and playing with it currently. It is still a huge mystery box to me, so I spent most of my time in the documents but now I couldn't figure out where to look so I came here.

I'm currently making a clone IDE/Code Editor type of program. I basically just added compile option to basic notepad example with QProcess which works. Now what I want to do is to implement a simultaneous file editing, or turn my program into online coding platform clone.

I was thinking maybe I could store some users in MySQL database. And when user1 opens a new document and invites user2, they both can edit user1's document. interviewing.io is a nice example to what I mean.

I don't want anyone to just come up with a direct solution. My intention is to learn but I couldn't find a starting point. I saw Session Management page but I'm not sure if that's what I need. I would be really happy if anyone would show me the way.

Btw, I'm on a Windows platform if that matters.

Thanks in advance!

[[qanda:topic_unsolved]] qt5 compile problem with QTabWidget::hasHeightForWidth()

$
0
0

g++ -c -pipe -O2 -Wall -std=c++11 -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtCore -I. -isystem /usr/include/libdrm -I/usr/lib64/qt5/mkspecs/linux-g++ -o GitStatusDialog.o GitStatusDialog.cpp
In file included from /usr/include/qt5/QtWidgets/qstyleoption.h:59,
from /usr/include/qt5/QtWidgets/qabstractitemdelegate.h:45,
from /usr/include/qt5/QtWidgets/qabstractitemview.h:47,
from /usr/include/qt5/QtWidgets/qlistview.h:44,
from /usr/include/qt5/QtWidgets/qlistwidget.h:44,
from /usr/include/qt5/QtWidgets/QListWidget:1,
from ui_GitStatusDialog.h:19,
from GitStatusDialog.h:8,
from GitStatusDialog.cpp:9:
/usr/include/qt5/QtWidgets/qtabwidget.h:126:10: error: ‘bool QTabWidget::hasHeightForWidth() const’ marked ‘override’, but does not override
126 | bool hasHeightForWidth() const override;
| ^~~~~~~~~~~~~~~~~
make: *** [Makefile:713: GitStatusDialog.o] Error 1

I've defined -std=c++11 but it doesn't make a difference. If I include <QtGui/QListWidget> instead of <QtWidgets/QListWidget in ui_GitStatusDialog.h it compiles but gives me linker errors for everything in moc_GitStatusDialog.cpp.

I've also tried including <QtCore> and <QtGui> in ui_GitStatusDialog.h but nothing helps.
Thank you.

[[qanda:topic_unsolved]] How to use Qt with Visual Studio 2017?

$
0
0
@JackBerman said in How to use Qt with Visual Studio 2017?: During its installation, administrator rights are required, if they are not present, the installation is successful, but the binding may not be complete. This is manifested in this way, xxxx.ui should turn into ui_xxxx.h during compilation, but the corresponding utility does not work and an error occurs. The uic tool that processes .ui files is part of Qt library, which is configured after the extension is already installed, so I don't see how running VS as an administrator could change anything. There's no binding at that point because there's nothing to bind yet. If you're having issues with the extension could you start a new thread?
Viewing all 60131 articles
Browse latest View live