Back to index

fet  5.18.0
Static Public Member Functions
LongTextMessageBox Class Reference

#include <longtextmessagebox.h>

List of all members.

Static Public Member Functions

static int confirmation (QWidget *parent, const QString &title, const QString &text, const QString &button0Text, const QString &button1Text, const QString &button2Text, int defaultButton, int escapeButton)
static int largeConfirmation (QWidget *parent, const QString &title, const QString &text, const QString &button0Text, const QString &button1Text, const QString &button2Text, int defaultButton, int escapeButton)
static int mediumConfirmation (QWidget *parent, const QString &title, const QString &text, const QString &button0Text, const QString &button1Text, const QString &button2Text, int defaultButton, int escapeButton)
static void information (QWidget *parent, const QString &title, const QString &text)
static void largeInformation (QWidget *parent, const QString &title, const QString &text)
static void mediumInformation (QWidget *parent, const QString &title, const QString &text)
static int confirmationWithDimensions (QWidget *parent, const QString &title, const QString &text, const QString &button0Text, const QString &button1Text, const QString &button2Text, int defaultButton, int escapeButton, int MINW, int MAXW, int MINH, int MAXH)
static void informationWithDimensions (QWidget *parent, const QString &title, const QString &text, int MINW, int MAXW, int MINH, int MAXH)

Detailed Description

Definition at line 31 of file longtextmessagebox.h.


Member Function Documentation

int LongTextMessageBox::confirmation ( QWidget *  parent,
const QString &  title,
const QString &  text,
const QString &  button0Text,
const QString &  button1Text,
const QString &  button2Text,
int  defaultButton,
int  escapeButton 
) [static]

Definition at line 142 of file longtextmessagebox.cpp.

{
       return LongTextMessageBox::confirmationWithDimensions(parent, title, text,
              button0Text, button1Text, button2Text,
              defaultButton, escapeButton,
              MIN_WIDTH, MAX_WIDTH, MIN_HEIGHT, MAX_HEIGHT);
}

Here is the call graph for this function:

int LongTextMessageBox::confirmationWithDimensions ( QWidget *  parent,
const QString &  title,
const QString &  text,
const QString &  button0Text,
const QString &  button1Text,
const QString &  button2Text,
int  defaultButton,
int  escapeButton,
int  MINW,
int  MAXW,
int  MINH,
int  MAXH 
) [static]

Definition at line 49 of file longtextmessagebox.cpp.

{
       if(button0Text==QString() || button1Text==QString() || button2Text!=QString()){
              QMessageBox::critical(parent, tr("FET critical"), tr("You have met a FET bug. The problem is in file"
               " %1 line %2, the reason is that a confirmation dialog box does not get exactly 2 arguments. Please report bug. FET will now continue."
               " You probably don't have any problems with your data file - you can save it.").arg(__FILE__).arg(__LINE__));
       }

       QDialog dialog(parent);
       dialog.setWindowTitle(title);
       
       QVBoxLayout* vl=new QVBoxLayout(&dialog);
       QPlainTextEdit* te=new QPlainTextEdit();
       te->setPlainText(text);
       te->setReadOnly(true);
       
       QPushButton* pb0=NULL;
       if(button0Text!=QString()){
              pb0=new QPushButton(button0Text);
              if(defaultButton==0)
                     connect(pb0, SIGNAL(clicked()), &dialog, SLOT(accept()));
              if(escapeButton==0)
                     connect(pb0, SIGNAL(clicked()), &dialog, SLOT(reject()));
       }
       
       QPushButton* pb1=NULL;
       if(button1Text!=QString()){
              pb1=new QPushButton(button1Text);
              if(defaultButton==1)
                     connect(pb1, SIGNAL(clicked()), &dialog, SLOT(accept()));
              if(escapeButton==1)
                     connect(pb1, SIGNAL(clicked()), &dialog, SLOT(reject()));
       }
       
       QPushButton* pb2=NULL;
       if(button2Text!=QString()){
              pb2=new QPushButton(button2Text);
              if(defaultButton==2)
                     connect(pb2, SIGNAL(clicked()), &dialog, SLOT(accept()));
              if(escapeButton==2)
                     connect(pb2, SIGNAL(clicked()), &dialog, SLOT(reject()));
       }
       
       QHBoxLayout* hl=new QHBoxLayout();
       hl->addStretch(1);
       if(pb0!=NULL)
              hl->addWidget(pb0);
       if(pb1!=NULL)
              hl->addWidget(pb1);
       if(pb2!=NULL)
              hl->addWidget(pb2);
              
       vl->addWidget(te);
       vl->addLayout(hl);
       
       if(pb0!=NULL && defaultButton==0){
              pb0->setDefault(true);
              pb0->setFocus();
       }
       if(pb1!=NULL && defaultButton==1){
              pb1->setDefault(true);
              pb1->setFocus();
       }
       if(pb2!=NULL && defaultButton==2){
              pb2->setDefault(true);
              pb2->setFocus();
       }
       
       int w=dialog.sizeHint().width();
       int h=dialog.sizeHint().height();
       if(w>MAXW) w=MAXW;
       if(w<MINW) w=MINW;
       if(h>MAXH) h=MAXH;
       if(h<MINH) h=MINH;
       dialog.resize(w, h);
       if(parent==0)
              forceCenterWidgetOnScreen(&dialog);
       
       int b=dialog.exec();
       
       if(b==QDialog::Accepted){
              //cout<<"accepted"<<endl;
              return defaultButton;
       }
       else{
              //cout<<"rejected"<<endl;
              return escapeButton;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void LongTextMessageBox::information ( QWidget *  parent,
const QString &  title,
const QString &  text 
) [static]

Definition at line 212 of file longtextmessagebox.cpp.

Here is the call graph for this function:

void LongTextMessageBox::informationWithDimensions ( QWidget *  parent,
const QString &  title,
const QString &  text,
int  MINW,
int  MAXW,
int  MINH,
int  MAXH 
) [static]

Definition at line 175 of file longtextmessagebox.cpp.

{
       QDialog dialog(parent);
       dialog.setWindowTitle(title);
       
       QVBoxLayout* vl=new QVBoxLayout(&dialog);
       QPlainTextEdit* te=new QPlainTextEdit();
       te->setPlainText(text);
       te->setReadOnly(true);
       
       QPushButton* pb=new QPushButton(tr("OK"));
       connect(pb, SIGNAL(clicked()), &dialog, SLOT(accept()));
       
       QHBoxLayout* hl=new QHBoxLayout();
       hl->addStretch(1);
       hl->addWidget(pb);
              
       vl->addWidget(te);
       vl->addLayout(hl);
       
       pb->setDefault(true);
       pb->setFocus();
       
       int w=dialog.sizeHint().width();
       int h=dialog.sizeHint().height();
       if(w>MAXW) w=MAXW;
       if(w<MINW) w=MINW;
       if(h>MAXH) h=MAXH;
       if(h<MINH) h=MINH;
       dialog.resize(w, h);
       if(parent==0)
              forceCenterWidgetOnScreen(&dialog);
       
       dialog.exec();
}

Here is the call graph for this function:

Here is the caller graph for this function:

int LongTextMessageBox::largeConfirmation ( QWidget *  parent,
const QString &  title,
const QString &  text,
const QString &  button0Text,
const QString &  button1Text,
const QString &  button2Text,
int  defaultButton,
int  escapeButton 
) [static]

Definition at line 153 of file longtextmessagebox.cpp.

{
       return LongTextMessageBox::confirmationWithDimensions(parent, title, text,
              button0Text, button1Text, button2Text,
              defaultButton, escapeButton,
              LARGE_MIN_WIDTH, LARGE_MAX_WIDTH, LARGE_MIN_HEIGHT, LARGE_MAX_HEIGHT);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void LongTextMessageBox::largeInformation ( QWidget *  parent,
const QString &  title,
const QString &  text 
) [static]

Definition at line 218 of file longtextmessagebox.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int LongTextMessageBox::mediumConfirmation ( QWidget *  parent,
const QString &  title,
const QString &  text,
const QString &  button0Text,
const QString &  button1Text,
const QString &  button2Text,
int  defaultButton,
int  escapeButton 
) [static]

Definition at line 164 of file longtextmessagebox.cpp.

{
       return LongTextMessageBox::confirmationWithDimensions(parent, title, text,
              button0Text, button1Text, button2Text,
              defaultButton, escapeButton,
              MEDIUM_MIN_WIDTH, MEDIUM_MAX_WIDTH, MEDIUM_MIN_HEIGHT, MEDIUM_MAX_HEIGHT);
}

Here is the call graph for this function:

void LongTextMessageBox::mediumInformation ( QWidget *  parent,
const QString &  title,
const QString &  text 
) [static]

Definition at line 224 of file longtextmessagebox.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: