Bug 162143

Summary: KDialog::resize(minimumSize()) completely hides dialog
Product: [Frameworks and Libraries] kdelibs Reporter: Stephen Kelly <steveire>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Stephen Kelly 2008-05-16 01:21:07 UTC
Version:            (using Devel)
Installed from:    Compiled sources

Hi,

The following code causes no visible dialog to be displayed. miminumSize should probably set the dialog to a minimum visible size. Currently it seems to set the size to 0 if there is no content in the dialog. It should be the minimum size containing the OK and CANCEL buttons.

Thanks.


== CMakeLists.txt
project(kfaildialog)
FIND_PACKAGE(KDE4 REQUIRED)

INCLUDE_DIRECTORIES( ${KDE4_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} )

set(kfaildialog_SRCS
   main.cpp
   kfailingdialog.cpp
 )

kde4_add_executable(kfaildialog ${kfaildialog_SRCS})

target_link_libraries(kfaildialog ${KDE4_KDEUI_LIBS} )

== kfailingdialog.cpp

#include "kfailingdialog.h"


#include <QLabel>
#include <QGridLayout>
#include <QtGui>

#include <KLocale>
#include <KComboBox>
#include <KLineEdit>
#include <KUrl>
#include <KActionCollection>
#include <kdebug.h>

#include <QLabel>
#include <QString>


KFailingDialog::KFailingDialog(QWidget *parent) :
    KDialog(parent)
{

    m_mainLabel = new QLabel( this );
    setMainWidget( m_mainLabel );

// Comment this to show dialog
    resize(minimumSize());
}

void KFailingDialog::setLabel( const QString& pattern )
{
    m_mainLabel->setText( pattern );

// Should really be here.
//   resize(minimumSize());
}

== kfailingdialog.h

#ifndef __KFAILINGDIALOG_H
#define __KFAILINGDIALOG_H

#include <KDialog>

// class QAbstractItemModel;
//
// class KUrl;
// class KComboBox;
// class KLineEdit;


class QLabel;
class QString;
class QAbstractItemModel;

class KUrl;
class KComboBox;
class KLineEdit;



class KFailingDialog : public KDialog
{
    Q_OBJECT
    public:
        KFailingDialog(QWidget *parent = 0 );
        void setLabel(const QString &s);
//         QString text();
//         KUrl href();


private:
    QLabel* m_mainLabel;
};

#endif

== main.cpp

#include "kfailingdialog.h"

#include <KApplication>
#include <KAboutData>
#include <KCmdLineArgs>

int main (int argc, char *argv[])
{
  KAboutData aboutData( "tutorial2", 0,
      ki18n("Tutorial 2"), "1.0",
      ki18n("A simple text area"),
      KAboutData::License_GPL,
      ki18n("Copyright (c) 2007 Developer") );
  KCmdLineArgs::init( argc, argv, &aboutData );

KApplication app;
    KFailingDialog* dlg = new KFailingDialog();
    dlg->exec();
app.exec();
}
Comment 1 Urs Wolfer 2008-05-17 01:58:59 UTC
SVN commit 808587 by uwolfer:

Improve performance of KDialog:
-> Do queued layouting.

Also try to reduce layouting everywhere in KDialog (for example when setting already active mainwindow again, ...) and other small improvements.

This also fixes an issue with setting minimumSize.
BUG:162143

 M  +35 -27    kdialog.cpp  
 M  +1 -0      kdialog.h  
 M  +4 -0      kdialog_p.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=808587