Passing an argument to a slot

With Qt 5 and a C++11 compiler, the idiomatic way to do such things is to give a functor to connect: connect(action1, &QAction::triggered, this, [this]{ onStepIncreased(1); }); connect(action5, &QAction::triggered, this, [this]{ onStepIncreased(5); }); connect(action10, &QAction::triggered, this, [this]{ onStepIncreased(10); }); connect(action25, &QAction::triggered, this, [this]{ onStepIncreased(25); }); connect(action50, &QAction::triggered, this, [this]{ onStepIncreased(50); }); The third argument to … Read more

QLabel does not display in QWidget

Widgets when they are visible for the first time call to be visible to their children, but since you are creating it afterwards they probably are not calling that method, a possible solution is to call the show method. void ChatWidget::displayChatAfterButtonPressed() { QLabel *lbl; lbl=new QLabel(this); lbl->setText(“Hello World 2”); lbl->show(); } comment: it seems strange … Read more

Porting C++ Builder to Qt [closed]

for TStatusBar, use QStatusBar for TListBox, use QListBox (Q3ListBox in Qt4) or QListWidget TStringGrid and TSpeedButton apparently have no equivalent. Use Qt demo software to see what Qt toolkit proposes and find what you are looking for. For other classes (not mentioned by OP): for TCheckBox, use QCheckBox for TRadioButton, use QRadioButton for TComboBox, use … Read more

Which yocto is best for me

Morty, Jethro, Fido etc. are not different “yoctos”, but different releases given the timeline of the project. Generally, pick the most current that is available, as it is the most actively maintained one. (At the current moment in time, Rocko is the stable release)

trying to implement the canny edge using opencv on qt creator [closed]

I have made a small changes its perfectly working void MainWindow::edgeImage() { image =cvLoadImage(FileName.toLocal8Bit().data()); Gray = cvCreateImage(cvSize(image->width,image->height),IPL_DEPTH_8U,1 ); cvCvtColor(image, Gray, CV_RGB2GRAY); canny= cvCreateImage(cvSize(image->width,image->height),IPL_DEPTH_8U,1 ); cvCanny(Gray,canny,50,150,3); QImage imgCanny = QImage((const unsigned char*)canny->imageData,canny->width,canny->height,QImage::Format_Indexed8); imgCanny.setPixel(0,0,qRgb(0,0,0)); ui->label_3->setPixmap(QPixmap::fromImage(imgCanny).scaled(ui->label_3->size())); }