Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Tags
    3. qlabel
    Log in to post

    • UNSOLVED QPushButton.click должен изменять мой QLabel
      Russian • qpushbutton qlabel click clicked • • Regex_brave  

      15
      0
      Votes
      15
      Posts
      138
      Views

      @Regex_brave Use lambdas (new style syntax) e.g. if you want to pass different parameters from signal to slot. Example: // member variables QPushButton *pb1, *pb2 pb1 = new QPushButton(this); pb1->setObjectName("PushButton #1"); pb2 = new QPushButton(this); pb2->setObjectName("PushButton #2"); connect(pb1, &QPushButton::clicked, this, &MainWindow::pushButtonClicked); connect(pb2, &QPushButton::clicked, this, &MainWindow::pushButtonClicked); connect(pb1, &QPushButton::clicked, this, []() { qDebug() << "A button was clicked, but *still* do not know which button"; }); // lambda connect(pb2, &QPushButton::clicked, this, []() { qDebug() << "A button was clicked, but *still* do not know which button"; }); // lambda connect(pb1, &QPushButton::clicked, this, [this]() { pushButtonClicked(pb1); }); // lambda connect(pb2, &QPushButton::clicked, this, [this]() { pushButtonClicked(pb2); }); // lambda void MainWindow::pushButtonClicked(bool checked = false) { qDebug() << "A button was clicked, but do not know which button"; } void MainWindow::pushButtonClicked(QPushButton *pb) { qDebug() << "Button was clicked, objectName:" << pb->objectName(); }
    • SOLVED Using QTimer::singleShot correctly for updating messages on GUI
      General and Desktop • qtcreator qlabel qtimer • • TUStudi  

      8
      0
      Votes
      8
      Posts
      139
      Views

      @TUStudi said: I actually have 6 QLabels, so I now have 6 timer and so on Derive a class from QLabel and add that functionality to it. Don't write the same code 6 times! My QLabels have the sizePolicy horizontal: preferred and vertical: fixed and a vertical length of 20. When a text is displayed, the QLabel expands so that the elements above the QLabel are also moved upwards and after the text disappears, they go back to their initial place. Fixed size policy means that widget uses its sizeHint() as the size. If you change the text the size hint also changes, so label grows/shrinks.
    • SOLVED QApplication, QLabel : no such file or directory
      Installation and Deployment • qlabel qapplication • • Genne  

      10
      0
      Votes
      10
      Posts
      133
      Views

      PATH ? Why did you change that environment variable manually ?
    • SOLVED QLabel with specific options
      General and Desktop • qlabel flags • • TomNow99  

      5
      0
      Votes
      5
      Posts
      44
      Views

      @Bonnie It works! Thank you Sir or Madame!
    • UNSOLVED Qt C++ How can I show a users basic informations in a new window after login?
      General and Desktop • qlabel login label profile qt5 c++11 • • moslehuddin  

      2
      0
      Votes
      2
      Posts
      44
      Views

      The question is very general. So what exactly is the problem you cannot solve, and what have you coded so far?
    • SOLVED problem with aligning text underneath buttons
      General and Desktop • layout qpushbutton qlabel pyqt4 • • cerr  

      3
      0
      Votes
      3
      Posts
      52
      Views

      Hi, To add a layout to a layout there's the "addLayout" method.
    • UNSOLVED QScrollArea not expanding when QPixmap is loaded
      General and Desktop • qlabel qpixmap qscrollarea • • Conical  

      3
      0
      Votes
      3
      Posts
      48
      Views

      Hi, How did you set the QLabel on your QScrollArea ? If you put it in a layout on the scroll area then that's wrong.
    • UNSOLVED Setting QPixmap to Qlabel gives segmentation fault and app crashes
      General and Desktop • qt5 qimage qlabel qpixmap gstreamer1.0 • • vicky_mac  

      22
      0
      Votes
      22
      Posts
      266
      Views

      Rather than giving the pointer to your MainWindow instance, pass directly the pointer to your label. Basically: mainwindow->ui->label
    • UNSOLVED Draw basic Axes on QPixmap ?
      General and Desktop • qlabel qpixmap qchart plot axis • • R-P-H  

      29
      0
      Votes
      29
      Posts
      1013
      Views

      Thanks for the support guys. I tried making a transparent QPixmap image using Qt::transparent fill for the axis and overlaying it onto my other QPixmap, however it didn't work properly. So I ended up just drawing directly onto the image itself. Not the most efficient method but it seems to work...
    • UNSOLVED Scaling pixmap images in qscrollarea
      General and Desktop • qlabel qpixmap qscrollarea • • rjmoses  

      4
      0
      Votes
      4
      Posts
      128
      Views

      @rjmoses Yes it will scale all images to match IconSize.
    • SOLVED Using a label to display large images in QT GUI
      General and Desktop • opengl opencv qlabel image display pixmap • • rtavakko  

      5
      0
      Votes
      5
      Posts
      367
      Views

      An update on this. It works perfectly and its a very low-cost solution. My processing time remains almost the same (~10mS) using this method since the painter does the scaling for you when it draws. Thanks for your help guys.
    • SOLVED Add Qlabel as item in QTableview
      General and Desktop • qtableview qtablewidget qlabel qstandarditem • • sayan275  

      3
      0
      Votes
      3
      Posts
      1174
      Views

      @SGaist said in Add Qlabel as item in QTableview: QStyledItemDelegate Ok..I'll try with that. from google search maybe this kind of output it will give, which maybe as our requirement. Else, I have some lengthy approach..implement custom label with mousepressevent handled which emits the object name and add these custom labels, 20 in HLayout and add hlayouts in a vlayout... Thanks!
    • SOLVED How do I explicitely position QLabels?
      General and Desktop • qlabel setgeometry placement • • mdresser  

      3
      0
      Votes
      3
      Posts
      254
      Views

      @SGaist Thank you very much for the quick reply. I've removed both the horizontal and vertical layout boxes and everything works exactly as I want. Sometimes newbies make life more complicated for themselves than it needs to be! Thanks again!
    • UNSOLVED how can i increase font size of QLabel with help of Qwidget::setFont()?
      General and Desktop • qwidget qlabel qfont • • Yash001  

      6
      0
      Votes
      6
      Posts
      1375
      Views

      no, decrese the font size and see if it works. then you'll know whether you can change font size at all. If it works then that should be a hint as to why you cannot increase the size.
    • UNSOLVED Paint Event and Zoomed In Image Problem
      General and Desktop • qlabel size zoom painter paint event • • Nalu323  

      4
      0
      Votes
      4
      Posts
      448
      Views

      @mrjj I tried your code, here's the result:
    • SOLVED I have a problem text rendering with Qt 5.7(QML)
      General and Desktop • qml qt 5.7 qlabel text • • MintogoDeveloper  

      4
      0
      Votes
      4
      Posts
      715
      Views

      I resolve it. I setted font of text as property of QML Text component. (Like font.family : parent.fontfamily) and on Qt 5.7's QML, there are no enough options to control font properties. so, I moved to C++ side and set a whole application font. QFont font = someClass.getLangFont(); //set property of font instance here // such as hinting policy, style etc. QApplication::setFont(font); now it looks very cleary... thank you..
    • UNSOLVED What's the fastest way to show JPG/JPEG images
      General and Desktop • qlabel qtimer streaming • • R_Irudezu  

      18
      0
      Votes
      18
      Posts
      3040
      Views

      Why are they not ?
    • UNSOLVED ImageViewer QLabel/QScrollArea top and bottom margins?
      General and Desktop • qlabel qscrollarea qguiapplication • • forlorn  

      6
      0
      Votes
      6
      Posts
      946
      Views

      The Basic Drawing Example shows that. In your case, you'd likely just have to paint your image using the correct scaling information.
    • UNSOLVED how to keep good quality of label in terms of pixel while changing the font Size?
      General and Desktop • qlabel qwt qstyle qstylesheet qfont • • Yash001  

      11
      0
      Votes
      11
      Posts
      1289
      Views

      @SGaist got it.
    • SOLVED Update QLabel text in a loop
      General and Desktop • qlabel loop settext • • A Former User  

      3
      0
      Votes
      3
      Posts
      1452
      Views

      Thanks for your answer, unfortunately this part of my code is executed in a class that inherits from QMainWindow, I don't have access to the QApplication. Edit: It works using QCoreApplication::processEvents() instead.
    • UNSOLVED How to create FloatingLabels in Qt...?
      General and Desktop • qlabel qlinedit floatinglabel • • mounipanditi  

      1
      0
      Votes
      1
      Posts
      338
      Views

      No one has replied

    • UNSOLVED QLabel not loading image after changing computers
      General and Desktop • qwidget qlabel qicon • • SolaVitae  

      6
      0
      Votes
      6
      Posts
      1011
      Views

      Hi, What do you mean by regular string ? If it comes from the Windows API, you should then consider using QDir:: fromNativeSeparators.
    • UNSOLVED QT Qsplitter disable scrollbar on resizing QLabel
      General and Desktop • qlabel c++ qt scrollarea qt5.10 • • magicstar  

      9
      0
      Votes
      9
      Posts
      2274
      Views

      @SGaist I tried very hard. But, still am not satisfied with the implementation. And now am feeling helpless. If I set set, fixedsize for QLabel, then scroll bars won't appear if I use zoomout/zoomin. My question is why QLabel won't shrink back after changing size through Qsplitter. I tried all the combinations of sizepolicy and nothing has worked so far
    • SOLVED How to know when cursor is out of qlabel when clicked??
      General and Desktop • qlabel mouseevent • • vasu_gupta  

      8
      0
      Votes
      8
      Posts
      2503
      Views

      Hi should that not be pointer ? QRubberBand rubberBand; -> QRubberBand * rubberBand; (since you do rubberBand= new QRubberBand(QRubberBand::Rectangle,this) ) that would explain all 3 errors.
    • UNSOLVED horizontally Alligning dynamically created widgets qt c++
      General and Desktop • qtcreator qlabel qline horizontal alli nment • • Lasith  

      6
      0
      Votes
      6
      Posts
      1387
      Views

      What you need in fact is a QFormLayout (a subset of the grid layout) where you can insert the pairs of widgets with QFormLayout::addRow.
    • UNSOLVED How to maintain aspect ratio of a Qlabel throughly??
      General and Desktop • qlabel qpixmap qt 5.9 • • vasu_gupta  

      1
      0
      Votes
      1
      Posts
      1023
      Views

      No one has replied

    • SOLVED Aligning qlabel text in centre
      General and Desktop • qlabel • • Sumit  

      7
      0
      Votes
      7
      Posts
      44061
      Views

      @Chris-Kawa I got the mistake, I was keeping size policy fixed due to which allignment has no effect on the text label. Thank you everyone. It got solved
    • UNSOLVED PNG Image not showing in QLabel
      General and Desktop • qt creator qlabel resources qt 5.8 png • • Jamie_Edwards  

      8
      0
      Votes
      8
      Posts
      2794
      Views

      Hi Jamie, Could you put the relevant parts in a minimal compilable example? otherwise we only can guess...
    • SOLVED QGraphicsDropShadowEffect and QResizeEvent
      General and Desktop • qlabel shadow qresizeevent qgraphicsdropsh • • J.Hilk  

      3
      0
      Votes
      3
      Posts
      1317
      Views

      Ok, I'll mark this as solved. I wasn't able to do it with QGraphicsDropShadowEffect, and creating all images twice and including them in the rcs-file is simply a no go. Therefore I create a function, that draws a shadow - all 4 sides - around the the QImages, either at startup or during runtime. Here it is, in case anyone else needs something like it. QImage drawShadow(QImage img) { //Condition img allready has a transparent border 4 Pixel in this case //Create new Img with same Size QImage imgBGround(img.size(), img.format()); //Fill it with transparency QPainter p(&imgBGround); QPen pen; pen.setStyle(Qt::NoPen); p.setPen(pen); p.setRenderHint(QPainter::Antialiasing); p.fillRect(QRect(0,0,img.width(), img.height()), QColor(255,255,255,0)); //Draw Rounded Rectangle as Shadow QPainterPath path; path.addRoundedRect(QRect(0,0,img.width(), img.height()),15,15); p.fillPath(path,QColor(110,152,226)); p.drawPath(path); //Draw Original Img over background p.drawImage(0,0,img); return imgBGround; }
    • UNSOLVED Dynamic changed text of sub menu is cutting off
      General and Desktop • qwidget qlabel qmenu qmenubar qwidgetaction • • Zee_07  

      13
      0
      Votes
      13
      Posts
      3530
      Views

      I helped myself to set a minimum size ->setMinimumSize(300) I also had to problem that at first pop up, my text was cut off. Nothing of the workarrounds mentioned here helped.
    • UNSOLVED Class variable updating / QLabel | Thread
      General and Desktop • qlabel class variable updat • • paul_b  

      2
      0
      Votes
      2
      Posts
      889
      Views

      Hi and welcome to devnet, What variable do you want to update ? Why do you think you need a thread for that ? On a side note, update is a QWidget non virtual slot so you can't use that name. In any case you should call labelTimr->setText("TIME :" + timeValue) to update the content of your QLabel.
    • UNSOLVED Need help optimizing the design of an image editor program
      General and Desktop • image qimage qlabel qpixmap image processin • • Wings  

      2
      0
      Votes
      2
      Posts
      1074
      Views

      Hi, QPainter can draw a QImage. So you can for example create a new Widget, subclass for QLabel for example if you want and reimplement paintEvent. Like this you work all the time with your QImage without creating another one. And better you can only update the region that changed, no need to refresh everything. I did not try it but it should work. Sincerely
    • The QLabel text not change.
      General and Desktop • qlabel • • MhM93  

      8
      0
      Votes
      8
      Posts
      2410
      Views

      I changed it to this code: QWidget *f=QApplication::activeWindow(); //if(mf!=NULL) if(f->windowTitle()=="User-Management") { //QMessageBox::warning(this, tr("Login failed"), "UserMng", QMessageBox::Ok); QLabel* lbl = f->findChild<QLabel*>("lblRFIDdata"); //mf->processData(output); lbl->setText(output); return; } and the label change. really thanks.
    • SOLVED Insert image on other QImage in QLabel
      General and Desktop • qimage qlabel • • kevin32  

      8
      0
      Votes
      8
      Posts
      8776
      Views

      Hi, You have two memory leaks now. There's no need to allocate pixmap nor painter on the heap. i.e: QPixmap pixmap(ui->label->width(), ui->label->height()); QPainter painter=(&pixmap); painter.drawPixmap(100, 0, 50, 50, QPixmap("C:/Users/user/Pictures/a.png")); painter.drawPixmap(0, 0, 100, 100, QPixmap("C:/Users/user/Pictures/1.png")); painter.end(); ui->label->setPixmap(pixmap);
    • SOLVED QLabel - mouseReleaseEvent to parent - HTML label
      General and Desktop • qlabel html mouseevent • • antonlindgren  

      7
      0
      Votes
      7
      Posts
      2509
      Views

      @mrjj Wow, super. That actually solved it. Thank you so much for your response, your time and your help. I really appreciate it. Thanks. Best regards, Anton
    • SOLVED QThread within the same class
      General and Desktop • qthread qlabel • • marlenet15  

      5
      0
      Votes
      5
      Posts
      1331
      Views

      I guess you are right. I will work on this without the Threads. Thank you for your help!
    • Can't set selection on QLabel after changing its text
      General and Desktop • qlabel • • AlaaM  

      2
      0
      Votes
      2
      Posts
      1330
      Views

      I solved it. Before setting selection, do clearFocus() and only then setFocus(). So, change these 2 lines: label->setFocus(); label->setSelection(INDEX , 1); to: label->clearFocus(); label->setFocus(); label->setSelection(INDEX , 1); That's very weird.
    • UNSOLVED Graphics glitch in QLabel (showing old image data when calling setText())
      General and Desktop • qlabel qpixmap x11 • • bepaald  

      5
      0
      Votes
      5
      Posts
      1815
      Views

      Thanks for the reply. This is using intel graphics, and unfortunately your workaround does not help. After your message, I've tested the same code from a newer live image and also on my more up-to-date laptop (which has similar hardware) and I can not reproduce the issue in either of these cases. On the affected machine, I tried updating the intel driver and mesa, but this did not solve it, so I guess it probably needs the kernel or qt packages updated as well. Unfortunately, this is not an option at this point. I've worked around the issue by re-implementing paintEvent() to do something like the following if (no_pixmap_set) { pos = calculateTextPosition() QPainter::drawText(pos, text); return; } QLabel::paintEvent(event); Which seems to work just fine. In fact, re-implementing the paintEvent has given me the chance to animate the image changes which looks pretty nice, and it will be easy to simplify the code a bit when all my machines are fully updated and the glitch is gone. Thanks again!
    • UNSOLVED move CLI text to QLabel
      General and Desktop • qlabel libssh • • rofiquzzaki  

      2
      0
      Votes
      2
      Posts
      858
      Views

      Hi and welcome to devnet, Rather than using extern variables you should encapsulate your ssh related code in a class and use it from your GUI. It will be easier to interface with it. Hope it helps