#include <QtWidgets/QMenu>
#include <QtWidgets/QAction>
#include <QtWidgets/QActionGroup>
+#ifndef QT_NO_CLIPBOARD
#include <QtGui/QClipboard>
+#endif
#include <QtWidgets/QUndoGroup>
#include <QtWidgets/QScrollArea>
#include <QtWidgets/QRubberBand>
return QString::fromUtf8(b.buffer());
}
+#ifndef QT_NO_CLIPBOARD
void FormWindow::copy()
{
QBuffer b;
deleteWidgets();
}
+void FormWindow::paste()
+{
+ paste(PasteAll);
+}
+#endif
+
// for cases like QMainWindow (central widget is an inner container) or QStackedWidget (page is an inner container)
QWidget *FormWindow::innerContainer(QWidget *outerContainer) const
{
return w;
}
-void FormWindow::paste()
-{
- paste(PasteAll);
-}
-
+#ifndef QT_NO_CLIPBOARD
// Construct DomUI from clipboard (paste) and determine number of widgets/actions.
static inline DomUI *domUIFromClipboard(int *widgetCount, int *actionCount)
{
}
return ui;
}
+#endif
static inline QString pasteCommandDescription(int widgetCount, int actionCount)
{
(*it)->move((*it)->pos() + offset);
}
+#ifndef QT_NO_CLIPBOARD
void FormWindow::paste(PasteMode pasteMode)
{
// Avoid QDesignerResource constructing widgets that are not used as
} while (false);
delete ui;
}
+#endif
// Draw a dotted frame around containers
bool FormWindow::frameNeeded(QWidget *w) const
// Initialize and return a popup menu for a managed widget
QMenu *initializePopupMenu(QWidget *managedWidget);
+#ifndef QT_NO_CLIPBOARD
virtual void paste(PasteMode pasteMode);
+#endif
virtual QEditorFormBuilder *createFormBuilder();
bool eventFilter(QObject *watched, QEvent *event);
void deleteWidgets();
void raiseWidgets();
void lowerWidgets();
+#ifndef QT_NO_CLIPBOARD
void copy();
void cut();
void paste();
+#endif
void selectAll();
void createLayout(int type, QWidget *container = 0);
#include <QtGui/QMouseEvent>
#include <QtWidgets/QApplication>
#include <QtWidgets/QSizeGrip>
+#ifndef QT_NO_CLIPBOARD
#include <QtGui/QClipboard>
+#endif
#include <QtWidgets/QMdiArea>
#include <QtWidgets/QMdiSubWindow>
#include <QtWidgets/QDesktopWidget>
case QEvent::ChildAdded:
case QEvent::ChildPolished:
case QEvent::ChildRemoved:
+#ifndef QT_NO_CLIPBOARD
case QEvent::Clipboard:
+#endif
case QEvent::ContentsRectChange:
case QEvent::DeferredDelete:
case QEvent::FileOpen:
void FormWindowManager::setupActions()
{
+#ifndef QT_NO_CLIPBOARD
m_actionCut = new QAction(createIconSet(QStringLiteral("editcut.png")), tr("Cu&t"), this);
m_actionCut->setObjectName(QStringLiteral("__qt_cut_action"));
m_actionCut->setShortcut(QKeySequence::Cut);
m_actionPaste->setWhatsThis(whatsThisFrom(QStringLiteral("Edit|Paste")));
connect(m_actionPaste, SIGNAL(triggered()), this, SLOT(slotActionPasteActivated()));
m_actionPaste->setEnabled(false);
+#endif
m_actionDelete = new QAction(tr("&Delete"), this);
m_actionDelete->setObjectName(QStringLiteral("__qt_delete_action"));
m_actionShowFormWindowSettingsDialog->setEnabled(false);
#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC)
+#ifndef QT_NO_CLIPBOARD
m_actionCopy->setIcon(QIcon::fromTheme(QStringLiteral("edit-copy"), m_actionCopy->icon()));
m_actionCut->setIcon(QIcon::fromTheme(QStringLiteral("edit-cut"), m_actionCut->icon()));
m_actionPaste->setIcon(QIcon::fromTheme(QStringLiteral("edit-paste"), m_actionPaste->icon()));
+#endif
m_actionDelete->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete"), m_actionDelete->icon()));
// These do not currently exist, but will allow theme authors to fill in the gaps
#endif
}
+#ifndef QT_NO_CLIPBOARD
void FormWindowManager::slotActionCutActivated()
{
m_activeFormWindow->cut();
{
m_activeFormWindow->paste();
}
+#endif
void FormWindowManager::slotActionDeleteActivated()
{
int selectedWidgetCount = 0;
int laidoutWidgetCount = 0;
int unlaidoutWidgetCount = 0;
+#ifndef QT_NO_CLIPBOARD
bool pasteAvailable = false;
+#endif
bool layoutAvailable = false;
bool breakAvailable = false;
bool simplifyAvailable = false;
QWidgetList simplifiedSelection = m_activeFormWindow->selectedWidgets();
selectedWidgetCount = simplifiedSelection.count();
+#ifndef QT_NO_CLIPBOARD
pasteAvailable = qApp->clipboard()->mimeData() && qApp->clipboard()->mimeData()->hasText();
+#endif
m_activeFormWindow->simplifySelection(&simplifiedSelection);
QWidget *mainContainer = m_activeFormWindow->mainContainer();
}
} while(false);
+#ifndef QT_NO_CLIPBOARD
m_actionCut->setEnabled(selectedWidgetCount > 0);
m_actionCopy->setEnabled(selectedWidgetCount > 0);
+ m_actionPaste->setEnabled(pasteAvailable);
+#endif
m_actionDelete->setEnabled(selectedWidgetCount > 0);
m_actionLower->setEnabled(canChangeZOrder && selectedWidgetCount > 0);
m_actionRaise->setEnabled(canChangeZOrder && selectedWidgetCount > 0);
- m_actionPaste->setEnabled(pasteAvailable);
m_actionSelectAll->setEnabled(m_activeFormWindow != 0);
QAction *FormWindowManager::action(Action action) const
{
switch (action) {
+#ifndef QT_NO_CLIPBOARD
case QDesignerFormWindowManagerInterface::CutAction:
return m_actionCut;
case QDesignerFormWindowManagerInterface::CopyAction:
return m_actionCopy;
case QDesignerFormWindowManagerInterface::PasteAction:
return m_actionPaste;
+#endif
case QDesignerFormWindowManagerInterface::DeleteAction:
return m_actionDelete;
case QDesignerFormWindowManagerInterface::SelectAllAction:
void deviceProfilesChanged();
private slots:
+#ifndef QT_NO_CLIPBOARD
void slotActionCutActivated();
void slotActionCopyActivated();
void slotActionPasteActivated();
+#endif
void slotActionDeleteActivated();
void slotActionSelectAllActivated();
void slotActionLowerActivated();
QWidget *m_morphLayoutContainer;
// edit actions
+#ifndef QT_NO_CLIPBOARD
QAction *m_actionCut;
QAction *m_actionCopy;
QAction *m_actionPaste;
+#endif
QAction *m_actionSelectAll;
QAction *m_actionDelete;
QAction *m_actionLower;
#include <QtWidgets/QToolButton>
#include <QtWidgets/QHBoxLayout>
#include <QtCore/QFileInfo>
+#ifndef QT_NO_CLIPBOARD
#include <QtGui/QClipboard>
+#endif
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QDialogButtonBox>
#include <QtWidgets/QPushButton>
void resourceActionActivated();
void fileActionActivated();
void themeActionActivated();
+#ifndef QT_NO_CLIPBOARD
void copyActionActivated();
void pasteActionActivated();
void clipboardDataChanged();
+#endif
private:
void updateLabels();
bool m_iconThemeModeEnabled;
connect(m_resourceAction, SIGNAL(triggered()), this, SLOT(resourceActionActivated()));
connect(m_fileAction, SIGNAL(triggered()), this, SLOT(fileActionActivated()));
connect(m_themeAction, SIGNAL(triggered()), this, SLOT(themeActionActivated()));
+#ifndef QT_NO_CLIPBOARD
connect(m_copyAction, SIGNAL(triggered()), this, SLOT(copyActionActivated()));
connect(m_pasteAction, SIGNAL(triggered()), this, SLOT(pasteActionActivated()));
+#endif
setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored));
setFocusProxy(m_button);
+#ifndef QT_NO_CLIPBOARD
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged()));
clipboardDataChanged();
+#endif
}
void PixmapEditor::setPixmapCache(DesignerPixmapCache *cache)
}
}
+#ifndef QT_NO_CLIPBOARD
void PixmapEditor::copyActionActivated()
{
QClipboard *clipboard = QApplication::clipboard();
const QString text = clipboard->text(subtype);
m_pasteAction->setEnabled(!text.isNull());
}
+#endif
// --------------- ResetWidget
class ResetWidget : public QWidget