Skip to content
  • 0 Votes
    6 Posts
    2k Views
    K
    Finally discovered the error here. Inspired here: https://forum.qt.io/topic/39319/solved-qprinterinfo-availableprinters-don-t-list-available-printers/2 the .dll file was from the previous version before upgrade and somehow didnt get upgraded along. So copying the file manually to the location instead of the previous dll version made it. Thanks for help, Kosmic
  • 0 Votes
    3 Posts
    879 Views
    jeanmilostJ
    @mrjj Thank you for your answer. So I tested to remove the text rectangle passed to the drawContents() function, and indeed the global clipping was applied instead.
  • 0 Votes
    1 Posts
    331 Views
    No one has replied
  • how to select file and then print to printer ?

    Unsolved General and Desktop print pdf file printsupport
    11
    0 Votes
    11 Posts
    9k Views
    JonBJ
    @Qjay This may not help because I do not know quite how you would do this directly from Qt, but when we want to print a PDF under Windows we use the underlying Win32 function ShellExecute() (https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153(v=vs.85).aspx) to go (effectively) ShellExecute("print", native-path-to-file), and let Windows shell sort it out. This is effectively the same as right-clicking on the file and picking the Print action. So you don't need to know anything about the actual process which does the printing, its arguments etc.
  • Resize A Picture When Print it

    Unsolved General and Desktop resize picture screen capture print
    8
    0 Votes
    8 Posts
    7k Views
    mrjjM
    @M4RZB4Ni yes, that is normal. Printer have many more pixels. so image seem smaller. Read docs. they have example of scaling stuff. This sample takes snapshot and scales it. void MainWindow::printshot() { QPixmap pix = QPixmap::grabWindow(QApplication::desktop()->winId()); QPrinter printer(QPrinter::HighResolution); printer.setOrientation(QPrinter::Landscape); QPainter painter; painter.begin(&printer); double xscale = printer.pageRect().width() / double(pix.width()); double yscale = printer.pageRect().height() / double(pix.height()); double scale = qMin(xscale, yscale); painter.translate(printer.paperRect().x() + printer.pageRect().width() / 2, printer.paperRect().y() + printer.pageRect().height() / 2); painter.scale(scale, scale); painter.translate(-width() / 2, -height() / 2); // note uses the form width/height! use pix.h/w if random image painter.drawPixmap(0, 0, pix); painter.end(); }
  • Qt Console Application - Print colored text

    Unsolved General and Desktop print color console
    12
    0 Votes
    12 Posts
    12k Views
    A
    Yes, the code you have there uses VT100 Escape Codes (note that \033 is the octal representation of character 27=escape. You could also use the hexadecimal \x1b instead), see http://en.wikipedia.org/wiki/ANSI_escape_code These require a terminal emulator that supports VT100, which almost all linux terminal emulators do. Windows Command Prompt doesn't support them by default, but at the bottom of https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences there is some code that shows how to turn that on (it's only a few lines of additional code that you only need to run once at the beginning - I would put it into an #ifdef __WIN32 #endif for platform independence.) I haven't actually tried that though and I'm not sure on which versions of windows it works. Regarding python: python doesn't natively support VT100 either, but the colorama package https://pypi.org/project/colorama/ enables them (to my knowledge, it replaces the print or write methods with something that extracts the escape codes and does the manipulations via calls to kernel32.dll methods).
  • 0 Votes
    7 Posts
    2k Views
    SGaistS
    Ok, so what happened before is that the item you added was destroyed before it could be shown
  • 0 Votes
    2 Posts
    5k Views
    JKSHJ
    Hi @AnantAgrawal, Just just launch your app from the console. qDebug, qWarning etc. will be printed to the console too (stdout/stderr). Make sure you don't define QT_NO_DEBUG_OUTPUT -- see http://doc.qt.io/qt-5/debug.html for more info.
  • 0 Votes
    3 Posts
    3k Views
    A7VictorA
    @mcosta Hi, I'll certainly take a look at it. So I guess it's not only changing the font xD Thank you.
  • 0 Votes
    7 Posts
    8k Views
    K
    Thanks Sam for Chris for great ideas. I had put together made an test implementation. I wrote a Makefile as release: main.cpp g++ main.cpp -o booh debug: main.cpp g++ main.cpp -o booh -DDEBUG_ENABLE Since release configuration at the top, that becomes default one. So, here in this case, release is by default. And, when someone wants to enable debug messages, they would call "make debug", which defines a MACRO called DEBUG_ENABLE. In the .cpp file, #ifdef DEBUG_ENABLE #define PRINTDEBUG(debugString) std::cout << (debugString) << std::endl; #else #define PRINTDEBUG(debugString) #endif So, based on configuration, Macro is either enabled or disabled. Thanks!
  • 0 Votes
    1 Posts
    2k Views
    No one has replied
  • 0 Votes
    5 Posts
    5k Views
    P
    it doesn't seem to matter what rectangle values I pass to drawImage, or if it's based on the paper size or even if I try a dummy rect that is like (0,0,50,50) - the resulting print still occupies the entire 8.5x11 sheet of paper and is cutoff on the right..