KexiBlobTableEdit::KexiBlobTableEdit(KexiTableViewColumn &column, QWidget *parent) : KexiTableEdit(column, parent) , d ( new Private() ) { setName("KexiBlobTableEdit"); // m_proc = 0; // m_content = 0; m_hasFocusableWidget = false; d->button = new KexiDropDownButton( parentWidget() /*usually a viewport*/ ); d->button->hide(); QToolTip::add(d->button, i18n("Click to show available actions for this cell")); d->popup = new KexiImageContextMenu(this); d->popup->installEventFilter(this); if (column.columnInfo) KexiImageContextMenu::updateTitle( d->popup, column.columnInfo->captionOrAliasOrName(), //! @todo pixmaplabel icon is hardcoded... "pixmaplabel" ); d->button->setPopup( d->popup ); //force edit requested to start editing... (this will call slotUpdateActionsAvailabilityRequested()) //connect(d->popup, SIGNAL(aboutToShow()), this, SIGNAL(editRequested())); connect(d->popup, SIGNAL(updateActionsAvailabilityRequested(bool&, bool&)), this, SLOT(slotUpdateActionsAvailabilityRequested(bool&, bool&))); connect(d->popup, SIGNAL(insertFromFileRequested(const KURL&)), this, SLOT(handleInsertFromFileAction(const KURL&))); connect(d->popup, SIGNAL(saveAsRequested(const QString&)), this, SLOT(handleSaveAsAction(const QString&))); connect(d->popup, SIGNAL(cutRequested()), this, SLOT(handleCutAction())); connect(d->popup, SIGNAL(copyRequested()), this, SLOT(handleCopyAction())); connect(d->popup, SIGNAL(pasteRequested()), this, SLOT(handlePasteAction())); connect(d->popup, SIGNAL(clearRequested()), this, SLOT(clear())); connect(d->popup, SIGNAL(showPropertiesRequested()), this, SLOT(handleShowPropertiesAction())); }
KexiDBImageBox::KexiDBImageBox(bool designMode, QWidget *parent) : KexiFrame(parent /* Qt 4 not neede: , Qt::WNoAutoErase*/) , KexiFormDataItemInterface() , m_alignment(Qt::AlignAuto | Qt::AlignTop) //2.0 moved to FormWidgetInterface , m_designMode(designMode) , m_readOnly(false) , m_scaledContents(false) , m_smoothTransformation(true) , m_keepAspectRatio(true) , m_insideSetData(false) , m_setFocusOnButtonAfterClosingPopup(false) // , m_lineWidthChanged(false) , m_paintEventEnabled(true) , m_dropDownButtonVisible(true) , m_insideSetPalette(false) { setDesignMode(designMode); installEventFilter(this); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); QPalette pal(palette()); pal.setBrush(backgroundRole(), QBrush(Qt::transparent)); KexiFrame::setPalette(pal); //setup context menu m_contextMenu = new KexiImageContextMenu(this); m_contextMenu->installEventFilter(this); if (designMode) { m_chooser = 0; } else { m_chooser = new KexiDropDownButton(this); m_chooser->setFocusPolicy(Qt::StrongFocus); m_chooser->setMenu(m_contextMenu); setFocusProxy(m_chooser); m_chooser->installEventFilter(this); // m_chooser->setPalette(qApp->palette()); // hlyr->addWidget(m_chooser); } setFrameShape(QFrame::Box); setFrameShadow(QFrame::Plain); setFrameColor(palette().color(QPalette::Foreground)); m_paletteBackgroundColorChanged = false; //set this here, not before connect(m_contextMenu, SIGNAL(updateActionsAvailabilityRequested(bool&,bool&)), this, SLOT(slotUpdateActionsAvailabilityRequested(bool&,bool&))); connect(m_contextMenu, SIGNAL(insertFromFileRequested(KUrl)), this, SLOT(handleInsertFromFileAction(KUrl))); connect(m_contextMenu, SIGNAL(saveAsRequested(QString)), this, SLOT(handleSaveAsAction(QString))); connect(m_contextMenu, SIGNAL(cutRequested()), this, SLOT(handleCutAction())); connect(m_contextMenu, SIGNAL(copyRequested()), this, SLOT(handleCopyAction())); connect(m_contextMenu, SIGNAL(pasteRequested()), this, SLOT(handlePasteAction())); connect(m_contextMenu, SIGNAL(clearRequested()), this, SLOT(clear())); connect(m_contextMenu, SIGNAL(showPropertiesRequested()), this, SLOT(handleShowPropertiesAction())); // connect(m_contextMenu, SIGNAL(aboutToHide()), this, SLOT(slotAboutToHidePopupMenu())); // if (m_chooser) { //we couldn't use m_chooser->setPopup() because of drawing problems // connect(m_chooser, SIGNAL(pressed()), this, SLOT(slotChooserPressed())); // connect(m_chooser, SIGNAL(released()), this, SLOT(slotChooserReleased())); // connect(m_chooser, SIGNAL(toggled(bool)), this, SLOT(slotToggled(bool))); // } KexiFrame::setLineWidth(0); setDataSource(QString()); //to initialize popup menu and actions availability }