Skip to content
QtWS25 Last Chance
  • 0 Votes
    6 Posts
    3k Views
    S
    Well, my research checks out, but my solution was still wrong. The solution worked on my computer, but it was not right on the next computer. Turns out, it was a case of "did you try to turn it off an on again?": I didn't restart my computer after switching the primary monitor in Windows. This is the real solution!
  • 0 Votes
    1 Posts
    656 Views
    No one has replied
  • 0 Votes
    6 Posts
    394 Views
    G
    Actually, 100% my fault. Things are plenty fast. I had an extra call to size() in my method that I didn't need, and that is a slow call. Thanks, Gerald
  • 0 Votes
    3 Posts
    1k Views
    BartoszPajB
    Settings for printer: _printer.setResolution(QPrinter::PrinterResolution); QPageSize pageSize(QPageSize::A4); _printer.setPageSize(pageSize); QPagedPaintDevice::Margins margins; margins.top = 11.5; margins.left = 12.6; margins.right = 11.5; margins.bottom = 11.8; _printer.setMargins (margins); _printer.setOutputFileName("output.pdf"); _printer.setOutputFormat(QPrinter::PdfFormat); Text Document QFont font; font.setPointSize(5); font.setFamily("Calibri"); font.setLetterSpacing(QFont::PercentageSpacing,100); doc.setDefaultFont(font); doc.setPageSize(_printer.pageSizeMM()); QTextCursor cursor(&doc); QTextBlockFormat block_format_title; block_format_title.setAlignment(Qt::AlignCenter); cursor.insertBlock(block_format_title); cursor.insertHtml(QString("<p><b>%1</b></p><br><br>").arg(file_theme.title)); QTextBlockFormat block_format; block_format.setAlignment(Qt::AlignLeft); cursor.insertBlock(block_format); cursor.insertHtml(QString("<p><b>Imię i nazwisko:</b> %1<br>").arg(file_theme.childName)); cursor.insertHtml(QString("<p><b>Terapeuta prowadzący:</b> %1<br>").arg(file_theme.therapistName)); cursor.insertHtml("<br>"); cursor.insertHtml(QString(HTML Text)); doc.print(&_printer); On yellow incorrect spaces between letters in word. [image: 6e3316c6-337b-4c5c-af91-f465c41ca4c1.JPG]
  • 0 Votes
    4 Posts
    881 Views
    J.HilkJ
    @diredko you can take a look at the Scalability section of the documentation The calculating scaling ratio section has an example that used to help me a lot when I first was confronted with this issue.
  • QPainter font on QOpenGLPaintDevice issues

    Unsolved General and Desktop font size qopenglpaintdev
    4
    0 Votes
    4 Posts
    959 Views
    K
    @joshh What version of Qt and what OS are you using? Can you post a minimum working example so we can test it too?
  • QFont::pixelSize returns -1

    Unsolved General and Desktop font size qfont
    6
    0 Votes
    6 Posts
    2k Views
    RatzzR
    @Asperamanca Doc says "Returns the pixel size of the font if it was set with setPixelSize() ". OP says " But I do not ever explicit used that methods in my program." so it returns -1 for him always.
  • QPushButton font size error

    Unsolved Mobile and Embedded qpushbutton font size stylesheet text
    2
    0 Votes
    2 Posts
    1k Views
    W
    The application runs in RAM, with all the qt dll useful for the deployment. Is it possible that a RAM corruption can cause a problem related to interface (font corruption, background image corruption...)? Thank you
  • 0 Votes
    7 Posts
    2k Views
    B
    I am posting my own binary search algorithm. BTW you can use QFontMetrics instead of QPainter if you want. int FontUtils::FittingLength(const QString& s, QPainter &p, const QRectF& rect, int flags/* = Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap*/) { QRectF r = p.boundingRect(rect, flags, s); if (r.height() <= rect.height()) // String fits rect. return s.length(); // Apply binary search. QString sub; int left = 0, right = s.length()-1; do { int pivot = (left + right)>>1; // Middle point. sub = s.mid(0, pivot+1); r = p.boundingRect(rect, flags, sub); if (r.height() > rect.height()) // Doesn't fit. right = pivot-1; else left = pivot+1; } while (left < right); left++; // Length of string is one char more. // Remove trailing word if it doesn't fit. if ( !s.at(left).isSpace() && !s.at(left+1).isSpace() ) { while ( (--left > 0) && !sub.at(left).isSpace() ); left++; } return left; }
  • 0 Votes
    6 Posts
    5k Views
    M
    @N.Sumi It doesn't work on the Jetson TK1 but it works on a desktop where I have Ubuntu 14.04 and where I built Qt Creator from the same source code. But, while on the desktop I have a standard Ubuntu 14.04, on Jetson TK1 there is a customized version of 14.04. I could think that there are some differences in some of the system libraries or some of those are missing. But I am not so experto to know where these differences are. I add also the libraries suggested here http://doc.qt.io/qtcreator/creator-faq.html but withour results. Anyway, thank you for your help.