StelDialog.cpp   StelDialog.cpp 
skipping to change at line 36 skipping to change at line 36
#include <QStyleOptionGraphicsItem> #include <QStyleOptionGraphicsItem>
class CustomProxy : public QGraphicsProxyWidget class CustomProxy : public QGraphicsProxyWidget
{ {
public: public:
CustomProxy(QGraphicsItem *parent = 0, Qt::WindowFlags wFlag s = 0) : QGraphicsProxyWidget(parent, wFlags) CustomProxy(QGraphicsItem *parent = 0, Qt::WindowFlags wFlag s = 0) : QGraphicsProxyWidget(parent, wFlags)
{ {
setFocusPolicy(Qt::StrongFocus); setFocusPolicy(Qt::StrongFocus);
} }
//! Reimplement this method to add windows decorations. Curr ently there are invisible 2 px decorations //! Reimplement this method to add windows decorations. Curr ently there are invisible 2 px decorations
void paintWindowFrame(QPainter *painter, const QStyleOptionG raphicsItem *option, QWidget *widget) void paintWindowFrame(QPainter*, const QStyleOptionGraphicsI tem*, QWidget*)
{ {
/* QStyleOptionTitleBar bar; /* QStyleOptionTitleBar bar;
initStyleOption(&bar); initStyleOption(&bar);
bar.subControls = QStyle::SC_TitleBarCloseButton; bar.subControls = QStyle::SC_TitleBarCloseButton;
qWarning() << style()->subControlRect(QStyle::CC_Tit leBar, &bar, QStyle::SC_TitleBarCloseButton); qWarning() << style()->subControlRect(QStyle::CC_Tit leBar, &bar, QStyle::SC_TitleBarCloseButton);
QGraphicsProxyWidget::paintWindowFrame(painter, opti on, widget);*/ QGraphicsProxyWidget::paintWindowFrame(painter, opti on, widget);*/
} }
protected: protected:
virtual bool event(QEvent* event) virtual bool event(QEvent* event)
skipping to change at line 60 skipping to change at line 60
widget()->setWindowOpacity(0.4); widget()->setWindowOpacity(0.4);
} }
if (event->type()==QEvent::WindowActivate) if (event->type()==QEvent::WindowActivate)
{ {
widget()->setWindowOpacity(0.9); widget()->setWindowOpacity(0.9);
} }
return QGraphicsProxyWidget::event(event); return QGraphicsProxyWidget::event(event);
} }
}; };
StelDialog::StelDialog() : dialog(NULL) StelDialog::StelDialog(QObject* parent) : QObject(parent), dialog(NULL)
{ {
} }
StelDialog::~StelDialog() StelDialog::~StelDialog()
{ {
} }
void StelDialog::close() void StelDialog::close()
{ {
setVisible(false); setVisible(false);
StelMainGraphicsView::getInstance().scene()->setActiveWindow(0); StelMainGraphicsView::getInstance().scene()->setActiveWindow(0);
((QGraphicsWidget*)StelMainGraphicsView::getInstance().getStelAppGra phicsWidget())->setFocus(Qt::OtherFocusReason); ((QGraphicsWidget*)StelMainGraphicsView::getInstance().getStelAppGra phicsWidget())->setFocus(Qt::OtherFocusReason);
} }
bool StelDialog::visible() const
{
return dialog!=NULL && dialog->isVisible();
}
void StelDialog::setVisible(bool v) void StelDialog::setVisible(bool v)
{ {
if (v) if (v)
{ {
QSize screenSize = StelMainGraphicsView::getInstance().size( ); QSize screenSize = StelMainGraphicsView::getInstance().size( );
if (dialog) if (dialog)
{ {
dialog->show(); dialog->show();
StelMainGraphicsView::getInstance().scene()->setActi veWindow(proxy); StelMainGraphicsView::getInstance().scene()->setActi veWindow(proxy);
// If the main window has been resized, it is possib le the dialog // If the main window has been resized, it is possib le the dialog
skipping to change at line 113 skipping to change at line 118
proxy = new CustomProxy(NULL, Qt::Tool); proxy = new CustomProxy(NULL, Qt::Tool);
proxy->setWidget(dialog); proxy->setWidget(dialog);
QRectF bound = proxy->boundingRect(); QRectF bound = proxy->boundingRect();
// centre with dialog according to current window size. // centre with dialog according to current window size.
proxy->setPos((int)((screenSize.width()-bound.width())/2), ( int)((screenSize.height()-bound.height())/2)); proxy->setPos((int)((screenSize.width()-bound.width())/2), ( int)((screenSize.height()-bound.height())/2));
StelMainGraphicsView::getInstance().scene()->addItem(proxy); StelMainGraphicsView::getInstance().scene()->addItem(proxy);
proxy->setWindowFrameMargins(2,0,2,2); proxy->setWindowFrameMargins(2,0,2,2);
// The caching is buggy on all plateforms with Qt 4.5.2 // The caching is buggy on all plateforms with Qt 4.5.2
proxy->setCacheMode(QGraphicsItem::DeviceCoordinateCache); proxy->setCacheMode(QGraphicsItem::ItemCoordinateCache);
proxy->setZValue(100); proxy->setZValue(100);
StelMainGraphicsView::getInstance().scene()->setActiveWindow (proxy); StelMainGraphicsView::getInstance().scene()->setActiveWindow (proxy);
proxy->setFocus(); proxy->setFocus();
} }
else else
{ {
dialog->hide(); dialog->hide();
emit visibleChanged(false); emit visibleChanged(false);
//proxy->clearFocus(); //proxy->clearFocus();
 End of changes. 4 change blocks. 
3 lines changed or deleted 8 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/