MCPcopy Create free account
hub / github.com/baumgarr/nixnote2 / drawRectSelection

Method drawRectSelection

dialog/screencapture.cpp:139–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139void ScreenCapture::drawRectSelection(QPainter &painter)
140{
141 painter.drawPixmap(selectRect, desktopPixmapClr, selectRect);
142 painter.setPen(QPen(QBrush(QColor(0, 0, 0, 255)), 2));
143 painter.drawRect(selectRect);
144
145 QString txtSize = QApplication::tr("%1 x %2 pixels ").arg(selectRect.width()).arg(selectRect.height());
146 painter.drawText(selectRect, Qt::AlignBottom | Qt::AlignRight, txtSize);
147
148 /* This does a zoom box around the selection.
149 if (!selEndPoint.isNull() ) // && conf->getZoomAroundMouse() == true)
150 {
151 const quint8 zoomSide = 200;
152
153 // create magnifer coords
154 QPoint zoomStart = selEndPoint;
155 zoomStart -= QPoint(zoomSide/5, zoomSide/5); // 40, 40
156
157 QPoint zoomEnd = selEndPoint;
158 zoomEnd += QPoint(zoomSide/5, zoomSide/5);
159
160 // creating rect area for magnifer
161 QRect zoomRect = QRect(zoomStart, zoomEnd);
162
163 QPixmap zoomPixmap = desktopPixmapClr.copy(zoomRect).scaled(QSize(zoomSide, zoomSide), Qt::KeepAspectRatio);
164
165 QPainter zoomPainer(&zoomPixmap); // create painter from pixmap maignifer
166 zoomPainer.setPen(QPen(QBrush(QColor(255, 0, 0, 180)), 2));
167 zoomPainer.drawRect(zoomPixmap.rect()); // draw
168 zoomPainer.drawText(zoomPixmap.rect().center() - QPoint(4, -4), "+");
169
170 // position for drawing preview
171 QPoint zoomCenter = selectRect.bottomRight();
172
173 if (zoomCenter.x() + zoomSide > desktopPixmapClr.rect().width() || zoomCenter.y() + zoomSide > desktopPixmapClr.rect().height())
174 {
175 zoomCenter -= QPoint(zoomSide, zoomSide);
176 }
177 painter.drawPixmap(zoomCenter, zoomPixmap);
178 }
179 */
180}
181
182QPixmap ScreenCapture::getSelection()
183{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected