Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Graphics
Krita
Commits
ec7ba6ab
Commit
ec7ba6ab
authored
Oct 25, 2022
by
Amy spark
👉
Browse files
Create New Document: fix Create button enabled when the clipboard has no images
BUG: 459800
(cherry picked from commit
7380f22b
)
parent
09bd4096
Changes
2
Hide whitespace changes
Inline
Side-by-side
libs/ui/widgets/kis_image_from_clipboard_widget.cpp
View file @
ec7ba6ab
...
...
@@ -113,13 +113,25 @@ void KisImageFromClipboardWidget::showEvent(QShowEvent *event)
void
KisImageFromClipboardWidget
::
createClipboardPreview
()
{
if
(
!
KisClipboard
::
instance
()
->
hasClip
())
return
;
if
(
!
KisClipboard
::
instance
()
->
hasClip
())
{
enableImageCreation
(
QImage
());
}
QApplication
::
setOverrideCursor
(
Qt
::
BusyCursor
);
QImage
qimage
=
QApplication
::
clipboard
()
->
image
();
enableImageCreation
(
qimage
);
if
(
!
qimage
.
isNull
())
{
QApplication
::
restoreOverrideCursor
();
}
void
KisImageFromClipboardWidget
::
enableImageCreation
(
const
QImage
&
qimage
)
{
if
(
qimage
.
isNull
())
{
doubleWidth
->
setValue
(
0
);
doubleHeight
->
setValue
(
0
);
newDialogConfirmationButtonBox
->
button
(
QDialogButtonBox
::
Ok
)
->
setEnabled
(
false
);
lblPreview
->
hide
();
}
else
{
QSize
previewSize
=
QSize
(
75
,
75
)
*
devicePixelRatioF
();
QPixmap
preview
=
QPixmap
::
fromImage
(
qimage
.
scaled
(
previewSize
,
Qt
::
KeepAspectRatio
));
preview
.
setDevicePixelRatio
(
devicePixelRatioF
());
...
...
@@ -129,15 +141,5 @@ void KisImageFromClipboardWidget::createClipboardPreview()
doubleWidth
->
setValue
(
qimage
.
width
());
doubleHeight
->
setValue
(
qimage
.
height
());
}
else
{
doubleWidth
->
setValue
(
0
);
doubleHeight
->
setValue
(
0
);
newDialogConfirmationButtonBox
->
button
(
QDialogButtonBox
::
Ok
)
->
setEnabled
(
false
);
lblPreview
->
hide
();
}
QApplication
::
restoreOverrideCursor
();
}
libs/ui/widgets/kis_image_from_clipboard_widget.h
View file @
ec7ba6ab
...
...
@@ -34,16 +34,15 @@ public:
KisImageFromClipboardWidget
(
QWidget
*
parent
,
qint32
defWidth
,
qint32
defHeight
,
double
resolution
,
const
QString
&
defColorModel
,
const
QString
&
defColorDepth
,
const
QString
&
defColorProfile
,
const
QString
&
imageName
);
~
KisImageFromClipboardWidget
()
override
;
private
Q_SLOTS
:
void
createImage
();
void
clipboardDataChanged
();
protected:
void
showEvent
(
QShowEvent
*
event
)
override
;
private
Q_SLOTS
:
void
createClipboardPreview
();
void
createImage
();
void
clipboardDataChanged
();
void
enableImageCreation
(
const
QImage
&
);
};
#endif
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment