本文整理汇总了C++中TCanvas::SetEditable方法的典型用法代码示例。如果您正苦于以下问题:C++ TCanvas::SetEditable方法的具体用法?C++ TCanvas::SetEditable怎么用?C++ TCanvas::SetEditable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCanvas
的用法示例。
在下文中一共展示了TCanvas::SetEditable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: zoomModelPreview
void NLSimpleGuiWindow::zoomModelPreview( double factor )
{
TQtWidget *qtWidget = ui->m_modelDisplayWidget;
QScrollArea *scrollArea = ui->m_modelDisplayScrollArea;
TCanvas *can = qtWidget->GetCanvas();
can->SetEditable( kTRUE );
can->Update(); //need this or else TCanvas won't have updated axis range
double xmin, xmax, ymin, ymax;
can->GetRangeAxis( xmin, ymin, xmax, ymax );
const double nMinutes = xmax - xmin;
if( nMinutes > 1 )
{
int canvasWidth = qtWidget->width();
int scrollAreaWidth = scrollArea->width();
int newWidth = factor * canvasWidth;
newWidth = max(newWidth, scrollAreaWidth);
newWidth = min(newWidth, 5*scrollAreaWidth);
if( newWidth == scrollAreaWidth )
scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
else scrollArea->setHorizontalScrollBarPolicy ( Qt::ScrollBarAsNeeded );
int h = scrollArea->height() - scrollArea->verticalScrollBar()->height();
qtWidget->setMinimumSize( newWidth, h );
qtWidget->setMaximumSize( newWidth, h );
}//if( nMinutes > 1 )
can->Update();
can->SetEditable( kFALSE );
}//void NLSimpleGuiWindow::zoomModelPreview( double factor )
示例2: greyscale
void greyscale()
{
TCanvas *c = new TCanvas("grey", "Grey Scale", 500, 500);
c->SetBorderMode(0);
Int_t n = 200; // tunable parameter
Float_t n1 = 1./n;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
TBox *b = new TBox(n1*j, n1*(n-1-i), n1*(j+1), n1*(n-i));
Float_t grey = Float_t(i*n+j)/(n*n);
b->SetFillColor(TColor::GetColor(grey, grey, grey));
b->Draw();
}
}
TPad *p = new TPad("p","p",0.3, 0.3, 0.7,0.7);
const char *guibackground = gEnv->GetValue("Gui.BackgroundColor", "");
p->SetFillColor(TColor::GetColor(guibackground));
p->Draw();
p->cd();
TText *t = new TText(0.5, 0.5, "GUI Background Color");
t->SetTextAlign(22);
t->SetTextSize(.09);
t->Draw();
c->SetEditable(kFALSE);
}
示例3:
TCanvas *NLSimpleGuiWindow::getModelCanvas()
{
ui->tabWidget->setCurrentWidget(ui->modelDisplyTab);
TCanvas *can = ui->m_modelDisplayWidget->GetCanvas();
can->cd();
can->SetEditable( kTRUE );
return can;
}//TVirtualPad *NLSimpleGuiWindow::getModelCanvas()
示例4: drawSelectedCustomEvent
void NLSimpleGuiWindow::drawSelectedCustomEvent()
{
const int index = getIdOfSelectedCustomEvent();
NLSimple::EventDefMap &evDefMap = m_model->m_customEventDefs;
//Make sure we have something selected
if( evDefMap.find(index) == evDefMap.end() ) return;
ui->tabWidget->setCurrentWidget(ui->customEventsTab);
TCanvas *can = ui->customEventDisplay->GetCanvas();
can->cd();
can->SetEditable( kTRUE );
cleanCanvas( can, "TFrame" ); //lets ovoid memmory clutter
evDefMap[index].draw();
can->SetEditable( kFALSE );
can->Update();
}//void NLSimpleGuiWindow::drawSelectedCustomEvent()
示例5: drawEquations
void NLSimpleGuiWindow::drawEquations()
{
TCanvas *can = ui->m_mathFormulaWidget->GetCanvas();
can->cd();
can->SetEditable( kTRUE );
m_equationPt->Clear();
vector<string> eqns = m_model->getEquationDescription();
foreach( const string &s, eqns ) m_equationPt->AddText( s.c_str() );
m_equationPt->Draw();
//need to make ROOTupdate gPad now
can->Update();
can->SetEditable( kFALSE );
can->SetEditable( kFALSE );
can->Update();
}// void NLSimpleGuiWindow::drawEquations()
示例6: drawModel
void NLSimpleGuiWindow::drawModel()
{
TCanvas *can = getModelCanvas();
cleanCanvas( can, "TFrame" ); //lets ovoid memmory clutter
PosixTime endTime = qtimeToPosixTime( ui->endDisplayTime->dateTime() );
PosixTime startTime = qtimeToPosixTime( ui->startDisplayTime->dateTime() );
TimeDuration deltaGeneric = (endTime-kGenericT0);
if( deltaGeneric.is_negative() ) deltaGeneric = -deltaGeneric;
if( deltaGeneric < TimeDuration(0,0,2,0) ) endTime = kGenericT0;
deltaGeneric = (startTime-kGenericT0);
if( deltaGeneric.is_negative() ) deltaGeneric = -deltaGeneric;
if( deltaGeneric < TimeDuration(0,0,2,0) ) startTime = kGenericT0;
m_model->draw( false, startTime, endTime );
can->SetEditable( kFALSE );
can->Update();
}//void NLSimpleGuiWindow::drawModel()
示例7: drawClarkAnalysis
void NLSimpleGuiWindow::drawClarkAnalysis( const ConsentrationGraph &xGraph,
const ConsentrationGraph &yGraph,
bool isCgmsVMeter )
{
ui->tabWidget->setCurrentWidget(ui->clarkeGridTab);
cleanupClarkAnalysis();
TimeDuration cmgsDelay(0,0,0,0);
if( isCgmsVMeter )
{
TCanvas *can = ui->clarkResultsWidget->GetCanvas();
can->cd();
can->SetEditable( kTRUE );
TPaveText *delayErrorEqnPt = new TPaveText(0, 0, 1.0, 1.0, "NDC");
delayErrorEqnPt->SetBorderSize(0);
delayErrorEqnPt->SetTextAlign(12);
cmgsDelay = m_model->findCgmsDelayFromFingerStick();
double sigma = 1000.0 * m_model->findCgmsErrorFromFingerStick(cmgsDelay);
sigma = static_cast<int>(sigma + 0.5) / 10.0; //nearest tenth of a percent
string delayStr = "Delay=";
delayStr += boost::posix_time::to_simple_string(cmgsDelay).substr(3,5);
delayStr += " ";
ostringstream uncertDescript;
uncertDescript << "#sigma_{cgms}^{finger}=" << sigma << "%";
delayErrorEqnPt->AddText( uncertDescript.str().c_str() );
delayErrorEqnPt->AddText( delayStr.c_str() );
delayErrorEqnPt->Draw();
can->SetEditable( kFALSE );
can->Update();
}//if( isCgmsVMeter )
TCanvas *can = ui->clarkeErrorGridWidget->GetCanvas();
can->cd();
can->SetEditable( kTRUE );
vector<TObject *> clarkesObj;
clarkesObj = getClarkeErrorGridObjs( yGraph, xGraph, cmgsDelay, true );
assert( dynamic_cast<TH1 *>(clarkesObj[0]) );
dynamic_cast<TH1 *>(clarkesObj[0])->GetYaxis()->SetTitleOffset(1.3);
clarkesObj[0]->Draw("SCAT");
clarkesObj[1]->Draw("SCAT SAME");
clarkesObj[2]->Draw("SCAT SAME");
clarkesObj[3]->Draw("SCAT SAME");
clarkesObj[4]->Draw("SCAT SAME");
TLegend *leg = dynamic_cast<TLegend *>( clarkesObj[5] );
assert( leg );
//Now draw all the boundry lines
for( size_t i=6; i < clarkesObj.size(); ++i ) clarkesObj[i]->Draw();
can->SetEditable( kFALSE );
can->Update();
// can->ResizePad();
// ui->clarkeErrorGridWidget->Refresh();
can = ui->clarkeLegendWidget->GetCanvas();
can->cd();
leg->SetX1(-0.1);
leg->SetX2(1.1);
leg->SetY1(0.0);
leg->SetY2(1.0);
leg->Draw();
can->SetEditable( kFALSE );
can->Update();
}// void NLSimpleGuiWindow::drawPredictedClarkAnalysis()
示例8: QMainWindow
NLSimpleGuiWindow::NLSimpleGuiWindow( NLSimple *model, QWidget *parent)
: QMainWindow(parent), ui(new Ui::NLSimpleGuiWindow), m_model(model),
m_ownsModel(model==NULL), m_fileName(""), m_equationPt(NULL),
m_programOptionsGui(NULL)
{
ui->setupUi(this);
if( !m_model ) openNewModel();
if( !m_model ) quit();
QMenu *fileMenu = ui->menuBar->addMenu( "&File" );
QAction *newAction = fileMenu->addAction( "&new model" );
QAction *openAction = fileMenu->addAction( "&open file" );
QAction *saveAction = fileMenu->addAction( "&save" );
QAction *saveAsAction = fileMenu->addAction( "save &as" );
QAction *quitAction = fileMenu->addAction( "&quit" );
connect( newAction, SIGNAL(triggered()), this, SLOT(openNewModel()) );
connect( openAction, SIGNAL(triggered()), this, SLOT(openExistingModel()) );
connect( saveAction, SIGNAL(triggered()), this, SLOT(saveModel()) );
connect( saveAsAction, SIGNAL(triggered()), this, SLOT(saveModelAs()) );
connect( quitAction, SIGNAL(triggered()), this, SLOT(quit()) );
TCanvas *can = ui->m_mathFormulaWidget->GetCanvas();
can->cd();
can->SetEditable( kTRUE );
m_equationPt = new TPaveText(0, 0, 1.0, 1.0, "NDC");
m_equationPt->SetBorderSize(0);
m_equationPt->SetTextAlign(12);
m_equationPt->Draw();
can->SetEditable( kFALSE );
can->Update();
//Add a button group so CLarke Error Grid buttons are mutually exclusive
m_clarkeButtonGroup = new QButtonGroup( this );
m_clarkeButtonGroup->addButton( ui->clarkCgmsVMeterRadioButton, 0 );
m_clarkeButtonGroup->addButton( ui->clarkePredVCGMSRadioButton, 1 );
ui->clarkCgmsVMeterRadioButton->setChecked(true);
connect( m_clarkeButtonGroup, SIGNAL(buttonClicked(int)),
this, SLOT(refreshClarkAnalysis()) );
//Make so Clarke Grid displays nice
can = ui->clarkeErrorGridWidget->GetCanvas();
can->cd();
can->Range(-45.17185,-46.4891,410.4746,410.6538);
can->SetFillColor(0);
can->SetBorderMode(0);
can->SetBorderSize(2);
can->SetRightMargin(0.031);
can->SetTopMargin(0.024);
can->SetFrameBorderMode(0);
QTabWidget *tw = ui->tabWidget;
tw->setTabText( tw->indexOf(ui->modelDisplyTab), "Display" );
tw->setTabText( tw->indexOf(ui->optionsTab), "Options" );
tw->setTabText( tw->indexOf(ui->clarkeGridTab), "Error Grid" );
tw->setTabText( tw->indexOf(ui->customEventsTab), "Custom Events" );
ui->endDisplayTime->setCalendarPopup(true);
ui->startDisplayTime->setCalendarPopup(true);
// ui->endDisplayTime->setDisplayFormat("MMM dd yy hh:mm AP");
// ui->startDisplayTime->setDisplayFormat("MMM dd yy hh:mm AP");
ui->tabWidget->setCurrentWidget(ui->customEventsTab);
m_customEventList = new QStandardItemModel(this/*ui->customEventLayout*/);
ui->customEventView->setModel(m_customEventList);
ui->customEventView->setShowGrid(false);
ui->customEventView->setAlternatingRowColors(true);
ui->customEventView->horizontalHeader()->setHidden(false);
connect( ui->geneticOptimizeButton, SIGNAL(clicked()), this, SLOT(doGeneticOptimization()) );
connect( ui->baysianFineTuneButton, SIGNAL(clicked()), this, SLOT(doMinuit2Fit()) );
connect( ui->addCgmsButton, SIGNAL(clicked()), this, SLOT(addCgmsData()) );
connect( ui->addMealDataButton, SIGNAL(clicked()), this, SLOT(addCarbData()) );
connect( ui->addMeterDataButton, SIGNAL(clicked()), this, SLOT(addMeterData()) );
connect( ui->addCustonDataBustom, SIGNAL(clicked()), this, SLOT(addCustomEventData()) );
connect( ui->redrawButton, SIGNAL(clicked()), this, SLOT(drawModel()) );
connect( ui->zoomIn, SIGNAL(clicked()), this, SLOT(zoomModelPreviewPlus()) );
connect( ui->zoomOut, SIGNAL(clicked()), this, SLOT(zoomModelPreviewMinus()) );
connect( ui->zoomIn, SIGNAL(clicked()), this, SLOT(zoomModelPreviewPlus()) );
connect( ui->endDisplayTime, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(checkDisplayTimeLimitsConsistency()) );
connect( ui->startDisplayTime, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(checkDisplayTimeLimitsConsistency()) );
connect( ui->endDisplayTime, SIGNAL(editingFinished()), this, SLOT(drawModel()) );
connect( ui->startDisplayTime, SIGNAL(editingFinished()), this, SLOT(drawModel()) );
connect( ui->addCustomEventButton, SIGNAL(clicked()), this, SLOT(addCustomEventDef()) );
connect( ui->deleteCustoEvenButton, SIGNAL(clicked()), this, SLOT(deleteCustomEventDef()) );
connect( ui->customEventView, SIGNAL(clicked(QModelIndex)), this, SLOT(drawSelectedCustomEvent()) );
init();
}//NLSimpleGuiWindow constructor