Table and Image in a single page of QTextDocument in Qt4 - qt

I want to display a table and a image side by side. i.e Left side the image and right side the table. I want this because the image is the reference image for the data present in the table. I want that output in pdf. So I am using QTextDocument, QTextCursor and QPrinter to get the output in pdf. So how it is possible to display the image and table in QtextDocument i.e within a single page of the pdf? I am using Qt 4.5.3 and Windows Xp. Any pointers regarding this are welcome.

Hi i managed to do that. Just adding the snippet if someone might need that..
QTextImageFormat m_ReferenceImageFormat;
m_ReferenceImageFormat.setWidth(525);
m_ReferenceImageFormat.setHeight(450);
m_ReferenceImageFormat.setName(imageFileName);
m_pReportCursor->insertImage(m_ReferenceImageFormat,QTextFrameFormat::FloatRight);
QTextTableFormat m_TableFormat;
m_TableFormat.setBorderStyle(QTextFrameFormat::BorderStyle_Solid);
m_TableFormat.setAlignment(Qt::AlignTop);
m_TableFormat.setWidth(400);
m_pReportCursor->insertTable(5,2,m_TableFormat);
// Table implementation goes here..
Just make sure that the image and table are not overlapping. Adjust width and height accordingly. It should work fine. Thats all.

Related

Can i make tree graph where button means leaf?

id like to do something like tree graph with buttons. Idk how to explain my idea so ive created image. I build my website via Elementor. Is it even possible please?
My image
You can do this in one section using buttons and dividers, set width for the divider, and set it using margin and padding

Place DataBand in a certain space

Im making a report with Stimulsoft Designer, and I place a lot of information. Now I need to place a data band for showing a list of phones in a certain space, but the only position on which the data band appears is on top (after header) and full width. That's not what I need, I need something like this:
I tried to create a "Data" square, and other options shown there, but it doesn't work. What I'am missing?
The solution is to add a panel with that shape, and insert the databand inside the panel

Dynamic chat bubble using autolayout

I am developing an application like iMessage.I would like to UI same like iMessage chat bubble work. I developed table view cell with auto layout.I have below table cell with UIImageView and UILabel.
UIImageView contain bubble image with resizableImageWithCapInsets. Right now everything is working fine except if text is small string then chat bubble is showing throughout the screen. so I would like to set constraints in such a way that my image view width will be according to label text. So if Label text is small then it will be small width image So it will be resizable according to width of label text. Any idea?
Current output:
.
I was thinking about my problem and researching on it and found below solutions. Posting it if it helps other.
So make it dynamic width based on text I put another blank label on right hand side and add constraints with it relative to left hand side controls(image view and label). Below is my final layout of constraints. Then it's working as expected.
Output Screen shot :

Qt: How to resize an image in a table?

This code correctly displays an image, and resizes it when the window is resized:
QLabel *imageLabel;
QTabWidget *imageTabWidget;
// new...
imageTabWidget->addTab(imageLabel, "Image");
I would like the same behaviour putting the image in a table (still inside the previous tab).
However all I can get now is a fixed size image:
QTableWidget *innerTable = new QTableWidget;
innerTable->setRowCount(1);
innerTable->setColumnCount(1);
innerTable->setCellWidget(0, 0, imageLabel);
innerTable->resizeColumnsToContents();
innerTable->resizeRowsToContents();
imageTabWidget->addTab(innerTable, "Image");
Is it possible to have a resizeable table at all?
Thank you.
You need to use layouts to get things to re-size how you'd like, see:
http://doc.qt.digia.com/qt/layout.html
Using the designer makes creating layouts much easier. (Create a widget in the designer then create an instance of it in code, then add to the tab widget).

How do I set the line height of a FormattedText

I am building a text-to-image generator that takes a text, a font, a max width and some other parameters and generates an image from this. It will be used as a custom server control in a web site to generate headlines.
I allready have a component like this which uses GDI+. The problem with this is that GDI+ is incapable of setting line height which means I have to render the text first and then copy the resulting rows into a new Bitmap using the line height I want.
I am now looking at using WPF components instead and have managed to create text images using FormattedText. The problem is that I still cannot set line height. Is there a way to do this? If I could set letter spacing as well, that would be even better.
You should just be able to set the LineHeight property, is that not working?

Resources