Back to index

fet  5.18.0
Functions | Variables
centerwidgetonscreen.cpp File Reference
#include "centerwidgetonscreen.h"
#include "fetmainform.h"
#include "rules.h"
#include "timetable.h"
#include <QWidget>
#include <QApplication>
#include <QDesktopWidget>
#include <QRect>
#include <QSize>
#include <QPoint>
#include <QSettings>
#include <QObject>
#include <QMetaObject>
#include <QString>
#include <QHeaderView>
#include <QTableWidget>
#include <QTableWidgetItem>
#include <QAbstractItemView>

Go to the source code of this file.

Functions

void centerWidgetOnScreen (QWidget *widget)
void forceCenterWidgetOnScreen (QWidget *widget)
int maxScreenWidth (QWidget *widget)
int maxRecommendedWidth (QWidget *widget)
void saveFETDialogGeometry (QWidget *widget, const QString &alternativeName)
void restoreFETDialogGeometry (QWidget *widget, const QString &alternativeName)
void setParentAndOtherThings (QWidget *widget, QWidget *parent)
void setStretchAvailabilityTableNicely (QTableWidget *notAllowedTimesTable)
void setRulesModifiedAndOtherThings (Rules *rules)
void setRulesUnmodifiedAndOtherThings (Rules *rules)

Variables

const QString COMPANY
const QString PROGRAM
FetMainFormpFetMainForm
Timetable gt
 The one and only instantiation of the main class.

Function Documentation

void centerWidgetOnScreen ( QWidget *  widget)

Definition at line 55 of file centerwidgetonscreen.cpp.

{
       Q_UNUSED(widget);

       //widget->setWindowFlags(widget->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint | Qt::WindowMinMaxButtonsHint);
       
/*     QRect frect=widget->frameGeometry();
       frect.moveCenter(QApplication::desktop()->availableGeometry(widget).center());
       widget->move(frect.topLeft());*/
}
void forceCenterWidgetOnScreen ( QWidget *  widget)

Definition at line 66 of file centerwidgetonscreen.cpp.

{
       //widget->setWindowFlags(widget->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint | Qt::WindowMinMaxButtonsHint);
       
       QRect frect=widget->frameGeometry();
       frect.moveCenter(QApplication::desktop()->availableGeometry(widget).center());
       widget->move(frect.topLeft());
}

Here is the caller graph for this function:

int maxRecommendedWidth ( QWidget *  widget)

Definition at line 93 of file centerwidgetonscreen.cpp.

{
       int d=maxScreenWidth(widget);
       
       if(d<800)
              d=800;
              
       //if(d>1000)
       //     d=1000;
       
       return d;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int maxScreenWidth ( QWidget *  widget)

Definition at line 86 of file centerwidgetonscreen.cpp.

{
       QRect rect = QApplication::desktop()->availableGeometry(widget);

       return rect.width();
}

Here is the caller graph for this function:

void restoreFETDialogGeometry ( QWidget *  widget,
const QString &  alternativeName 
)

Definition at line 117 of file centerwidgetonscreen.cpp.

{
       QSettings settings(COMPANY, PROGRAM);
       QString name=QString(widget->metaObject()->className());
       if(!alternativeName.isEmpty())
              name=alternativeName;
       if(settings.contains(name+QString("/geometry"))){
              QRect rect=settings.value(name+QString("/geometry")).toRect();
              if(rect.isValid())
                     widget->setGeometry(rect);
       }
}
void saveFETDialogGeometry ( QWidget *  widget,
const QString &  alternativeName 
)

Definition at line 106 of file centerwidgetonscreen.cpp.

{
       QSettings settings(COMPANY, PROGRAM);
       QString name=QString(widget->metaObject()->className());
       if(!alternativeName.isEmpty())
              name=alternativeName;
       
       QRect rect=widget->geometry();
       settings.setValue(name+QString("/geometry"), rect);
}
void setParentAndOtherThings ( QWidget *  widget,
QWidget *  parent 
)

Definition at line 130 of file centerwidgetonscreen.cpp.

{
       Q_UNUSED(widget);
       Q_UNUSED(parent);

/*     if(!widget->parentWidget()){
              widget->setParent(parent, Qt::Dialog);
       
              QRect rect=widget->geometry();
              rect.translate(widget->geometry().x() - widget->frameGeometry().x(), widget->geometry().y() - widget->frameGeometry().y());
              widget->setGeometry(rect);
       }*/
}

Definition at line 168 of file centerwidgetonscreen.cpp.

{
       if(!rules->modified){
              rules->modified=true;
       
              if(rules==&gt.rules && pFetMainForm!=NULL)
                     if(!pFetMainForm->isWindowModified())
                            pFetMainForm->setWindowModified(true);
       }
}

Definition at line 179 of file centerwidgetonscreen.cpp.

{
       if(rules->modified){
              rules->modified=false;
       
              if(rules==&gt.rules && pFetMainForm!=NULL)
                     if(pFetMainForm->isWindowModified())
                            pFetMainForm->setWindowModified(false);
       }
}

Here is the caller graph for this function:

void setStretchAvailabilityTableNicely ( QTableWidget *  notAllowedTimesTable)

Definition at line 144 of file centerwidgetonscreen.cpp.

{
       notAllowedTimesTable->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
       int q=notAllowedTimesTable->horizontalHeader()->defaultSectionSize();
       notAllowedTimesTable->horizontalHeader()->setMinimumSectionSize(q);

       notAllowedTimesTable->verticalHeader()->setResizeMode(QHeaderView::Stretch);
       q=-1;
       for(int i=0; i<notAllowedTimesTable->verticalHeader()->count(); i++)
              if(q<notAllowedTimesTable->verticalHeader()->sectionSizeHint(i))
                     q=notAllowedTimesTable->verticalHeader()->sectionSizeHint(i);
       notAllowedTimesTable->verticalHeader()->setMinimumSectionSize(q);
       
       //2011-09-23
       for(int i=0; i<notAllowedTimesTable->rowCount(); i++){
              for(int j=0; j<notAllowedTimesTable->columnCount(); j++){
                     QFont font=notAllowedTimesTable->item(i,j)->font();
                     font.setBold(true);
                     notAllowedTimesTable->item(i,j)->setFont(font);
              }
       }
       notAllowedTimesTable->setCornerButtonEnabled(false);
}

Here is the caller graph for this function:


Variable Documentation

const QString COMPANY

Definition at line 260 of file fetmainform.cpp.

The one and only instantiation of the main class.

Definition at line 99 of file fet.cpp.

Definition at line 132 of file fet.cpp.

const QString PROGRAM

Definition at line 261 of file fetmainform.cpp.