Commit b486626c authored by Aurélien Gâteau's avatar Aurélien Gâteau
Browse files

Started implementation of a DocumentView class, so that the view has a sensible

sizeHint when nothing is displayed.

svn path=/trunk/playground/graphics/gwenview/; revision=637260
parent 478327a5
include_directories(${CMAKE_SOURCE_DIR}/gwenview)
set(gwenview_SRCS main.cpp mainwindow.cpp)
set(gwenview_SRCS
documentview.cpp
main.cpp
mainwindow.cpp
)
kde4_automoc(${gwenview_SRCS})
kde4_add_executable(gwenview ${gwenview_SRCS})
......
/*
Gwenview: an image viewer
Copyright 2007 Aurélien Gâteau
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "documentview.moc"
// Qt
#include <QPainter>
// KDE
#include <klocale.h>
namespace Gwenview {
DocumentView::DocumentView(QWidget* parent)
: QWidget(parent)
{}
QSize DocumentView::sizeHint() const {
return QSize(400, 300);
}
void DocumentView::paintEvent(QPaintEvent*) {
QPainter painter(this);
painter.drawText(rect(), Qt::AlignCenter, i18n("No document selected"));
}
} // namespace
/*
Gwenview: an image viewer
Copyright 2007 Aurélien Gâteau
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DOCUMENTVIEW_H
#define DOCUMENTVIEW_H
// Qt
#include <QWidget>
namespace Gwenview {
class DocumentView : public QWidget {
Q_OBJECT
public:
DocumentView(QWidget*);
virtual QSize sizeHint() const;
protected:
virtual void paintEvent(QPaintEvent*);
};
} // namespace
#endif /* DOCUMENTVIEW_H */
......@@ -43,9 +43,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <kxmlguifactory.h>
// Local
#include <lib/thumbnailview.h>
#include "documentview.h"
#include <lib/mimetypeutils.h>
#include <lib/sorteddirmodel.h>
#include <lib/thumbnailview.h>
namespace Gwenview {
......@@ -79,7 +80,7 @@ static bool urlIsDirectory(QWidget* parent, const KUrl& url) {
struct MainWindow::Private {
MainWindow* mWindow;
QWidget* mDocumentView;
DocumentView* mDocumentView;
QVBoxLayout* mDocumentLayout;
QToolButton* mGoUpButton;
KUrlRequester* mUrlRequester;
......@@ -106,7 +107,8 @@ struct MainWindow::Private {
mSideBar = new QFrame(centralSplitter);
mSideBar->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
mDocumentView = new QWidget(viewSplitter);
mDocumentView = new DocumentView(viewSplitter);
mDocumentLayout = new QVBoxLayout(mDocumentView);
mDocumentLayout->setMargin(0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment