how can i take an image from a specific part of my mainwindow and save it?
hi,
is it possible to take a picture from a certain place of the MainWindow and save it? like printscreen but only a piece and certain place of my window must be in the picture.
Re: how can i take an image from a specific part of my mainwindow and save it?
1 Attachment(s)
Re: how can i take an image from a specific part of my mainwindow and save it?
Thanks d_stranz, I could save the entry of myMainWindow by under code:
Code:
MainWindow *w;
w = new MainWindow;
w->render(&pixmap);
pixmap.save("h.bmp");
w->show();
I need to take an image from into the red box that you can see in the uploaded image. That the positions are:
position 1: beginning of "GroupBox"
position 2: top right of "b1"
position 3: down left of "GroupBox"
position 4: x=down left of "GroupBox", y=top right of "b1"
thanks for any help about working with 4 above positions because the size of MainWindow can be changed by pulling the window.
Attachment 11589
Re: how can i take an image from a specific part of my mainwindow and save it?
If you only want the groupbox then call its render() method.
If you need things across container widgets, render the widget that contains all and use QPixmap::copy() to extract the part you are interested in.
Cheers,
_
Re: how can i take an image from a specific part of my mainwindow and save it?
Quote:
Originally Posted by
anda_skoa
If you only want the groupbox then call its render() method.
If you need things across container widgets, render the widget that contains all and use
QPixmap::copy() to extract the part you are interested in.
Cheers,
_
thanks. no i need the red box screen-shot that i draw in uploaded image and contains the GroupBox and 4 PushButttons(not just GroupBox). I told which positions are needed. please help me to do by those positions (4 positions that i told in my before post above).
Re: how can i take an image from a specific part of my mainwindow and save it?
You could put the buttons and the groupbox into a container widget and then render this widget.
Or you just calculate the coordinates manually and use the already mentioned copy method.
Cheers,
_
Re: how can i take an image from a specific part of my mainwindow and save it?
Quote:
Originally Posted by
anda_skoa
You could put the buttons and the groupbox into a container widget and then render this widget.
Or you just calculate the coordinates manually and use the already mentioned copy method.
Cheers,
_
thanks anda, but sorry i am newbie in Qt. please give me an example