本文整理汇总了C++中Stylesheet::getStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ Stylesheet::getStyle方法的具体用法?C++ Stylesheet::getStyle怎么用?C++ Stylesheet::getStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stylesheet
的用法示例。
在下文中一共展示了Stylesheet::getStyle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setOutputStyle
/*!
* \author Anders Fernström
* \date 2006-04-21
*
* \brief Set the output style
*/
void InputCell::setOutputStyle()
{
// Set the correct style for the QTextEdit output_
output_->selectAll();
Stylesheet *sheet = Stylesheet::instance( "stylesheet.xml" );
CellStyle style = sheet->getStyle( "Output" );
if( style.name() != "null" )
{
output_->setAlignment( (Qt::AlignmentFlag)style.alignment() );
output_->mergeCurrentCharFormat( (*style.textCharFormat()) );
output_->document()->rootFrame()->setFrameFormat( (*style.textFrameFormat()) );
}
else
{
// 2006-01-30 AF, add message box
QString msg = "No Output style defened, please define a Output style in stylesheet.xml";
QMessageBox::warning( 0, "Warning", msg, "OK" );
}
QTextCursor cursor = output_->textCursor();
cursor.clearSelection();
output_->setTextCursor( cursor );
}
示例2: setStyle
/*!
* \author Anders Fernström
* \date 2005-10-28
*
* \brief Set cell style
*
* \param stylename The style name of the style that is to be applyed to the cell
*/
void Cell::setStyle(const QString &stylename)
{
Stylesheet *sheet = Stylesheet::instance( "stylesheet.xml" );
CellStyle style = sheet->getStyle( stylename );
if( style.name() != "null" )
setStyle( style );
else
{
cout << "Can't set style, style name: " << stylename.toStdString() << " is not valid" << endl;
}
}
示例3: runtime_error
/*!
* \author Ingemar Axelsson and Anders Fernström
*
*
* \todo Remove document dependency from Cellstructure. It is only
* used to point to a commandcenter (in this case the current
* document) and for the click event to get the current
* cursor. This can be done in some better way. Maybe by sending a
* signal to the document instead.(Ingemar Axelsson)
*/
Cell *CellFactory::createCell(const QString &style, Cell *parent)
{
if(style == "input" || style == "Input" || style == "ModelicaInput")
{
InputCell *text = new InputCell(doc_, parent);
try
{
Stylesheet *sheet = Stylesheet::instance( "stylesheet.xml" );
CellStyle cstyle = sheet->getStyle( "Input" );
if( cstyle.name() != "null" )
text->setStyle( cstyle );
else
throw runtime_error("No Input style defened, the inputcell may not work correctly, please define a Input style in stylesheet.xml");
}
catch( exception e )
{
QMessageBox::warning( 0, "Warning", e.what(), "OK" );
}
try
{
text->setDelegate(OmcInteractiveEnvironment::getInstance());
}
catch( exception e )
{}
QObject::connect(text, SIGNAL(cellselected(Cell *,Qt::KeyboardModifiers)),
doc_, SLOT(selectedACell(Cell*,Qt::KeyboardModifiers)));
QObject::connect(text, SIGNAL(clicked(Cell *)),
doc_, SLOT(mouseClickedOnCell(Cell*)));
QObject::connect(text, SIGNAL(clickedOutput(Cell *)),
doc_, SLOT(mouseClickedOnCellOutput(Cell*)));
// 2005-11-29 AF
QObject::connect( text, SIGNAL( heightChanged() ),
doc_, SLOT( updateScrollArea() ));
// 2006-01-17 AF
QObject::connect( text, SIGNAL( textChanged(bool) ),
doc_, SLOT( setChanged(bool) ));
// 2006-04-27 AF
QObject::connect( text, SIGNAL( forwardAction(int) ),
doc_, SIGNAL( forwardAction(int) ));
// CellDocument* d = dynamic_cast<CellDocument*>(doc_);
// DocumentView* d2 = d->observers_[0];
// NotebookWindow *d3 = dynamic_cast<NotebookWindow*>(d2);
QObject::connect(text->input_, SIGNAL(copyAvailable(bool)), doc_, SIGNAL(copyAvailable(bool)));
QObject::connect(text->input_, SIGNAL(undoAvailable(bool)), doc_, SIGNAL(undoAvailable(bool)));
QObject::connect(text->input_, SIGNAL(redoAvailable(bool)), doc_, SIGNAL(redoAvailable(bool)));
QObject::connect(text->output_, SIGNAL(copyAvailable(bool)), doc_, SIGNAL(copyAvailable(bool)));
//QObject::connect(doc_, SIGNAL(evaluate()), text->input_, SIGNAL(eval()));
/*
QObject::connect(text->input_, SIGNAL(copyAvailable(bool)), d3->copyAction, SLOT(setEnabled(bool)));
QObject::connect(text->input_, SIGNAL(copyAvailable(bool)), d3->cutAction, SLOT(setEnabled(bool)));
QObject::connect(text->input_, SIGNAL(undoAvailable(bool)), d3->undoAction, SLOT(setEnabled(bool)));
QObject::connect(text->input_, SIGNAL(redoAvailable(bool)), d3->redoAction, SLOT(setEnabled(bool)));
QObject::connect(text->output_, SIGNAL(copyAvailable(bool)), d3->copyAction, SLOT(setEnabled(bool)));
*/
return text;
}