Author: schubi2 Date: Fri Jul 13 15:13:14 2007 New Revision: 6005 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6005&view=rev Log: improved layout Modified: branches/tmp/schubi/solvertree/QZyppSolverDialog.cpp branches/tmp/schubi/solvertree/resgraphview.cpp branches/tmp/schubi/solvertree/resgraphview.h branches/tmp/schubi/solvertree/restreewidget.cpp Modified: branches/tmp/schubi/solvertree/QZyppSolverDialog.cpp URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/solvertree/QZyppSolverDialog.cpp?rev=6005&r1=6004&r2=6005&view=diff ============================================================================== --- branches/tmp/schubi/solvertree/QZyppSolverDialog.cpp (original) +++ branches/tmp/schubi/solvertree/QZyppSolverDialog.cpp Fri Jul 13 15:13:14 2007 @@ -12,7 +12,9 @@ : QDialog(0,"Solvertree",true) , resolver (r) { - SolverTree *solvertree = new SolverTree(this, resolver); + QHBoxLayout* layout = new QHBoxLayout (this); + SolverTree *solvertree = new SolverTree(this, resolver); + layout->addWidget( solvertree->getView()); } Modified: branches/tmp/schubi/solvertree/resgraphview.cpp URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/solvertree/resgraphview.cpp?rev=6005&r1=6004&r2=6005&view=diff ============================================================================== --- branches/tmp/schubi/solvertree/resgraphview.cpp (original) +++ branches/tmp/schubi/solvertree/resgraphview.cpp Fri Jul 13 15:13:14 2007 @@ -151,7 +151,8 @@ void ResGraphView::endInsert() { if (m_Canvas) { - _cvZoom = 0; + _cvZoomH = 0; + _cvZoomW = 0; updateSizes(); m_Canvas->update(); } @@ -167,7 +168,7 @@ QRegExp endslash("\\\\\\n"); dotOutput.replace(endslash,""); -#if 1 +#if 0 QFile *dot = new QFile("dotoutput"); dot->open(IO_ReadWrite); QTextStream stream(dot); @@ -560,26 +561,36 @@ // at most a zoom of 1/3 if (zoom > .33) zoom = .33; - if (zoom != _cvZoom) { - _cvZoom = zoom; - if (0) qDebug("Canvas Size: %dx%d, Visible: %dx%d, Zoom: %f", + double cvZoomW = zoom; + double cvZoomH = zoom; + + // show at least 1/20 of the frame + if (cWidth * cvZoomW < s.width()/20) cvZoomW = s.width() / (double)cWidth / 20; + if (cHeight * cvZoomH < s.height()/20) cvZoomH = s.height() / (double)cHeight / 20; + + if (cvZoomW != _cvZoomW + || cvZoomH != _cvZoomH) { + _cvZoomW = cvZoomW; + _cvZoomH = cvZoomH; + + if (1) qDebug("Canvas Size: %dx%d, Visible: %dx%d, ZoomH: %f, ZoomW: %f", m_Canvas->width(), m_Canvas->height(), - cWidth, cHeight, zoom); + cWidth, cHeight, cvZoomH, cvZoomW); QWMatrix wm; - wm.scale( zoom, zoom ); + wm.scale( _cvZoomW, _cvZoomH ); m_CompleteView->setWorldMatrix(wm); // make it a little bigger to compensate for widget frame - m_CompleteView->resize(int(cWidth * zoom) + 4, - int(cHeight * zoom) + 4); + m_CompleteView->resize(int(cWidth * _cvZoomW) + 4, + int(cHeight * _cvZoomH) + 4); // update ZoomRect in completeView contentsMovingSlot(contentsX(), contentsY()); } - m_CompleteView->setContentsPos(int(zoom*(_xMargin-50)), - int(zoom*(_yMargin-50))); + m_CompleteView->setContentsPos(int(_cvZoomW*(_xMargin-50)), + int(_cvZoomH*(_yMargin-50))); updateZoomerPos(); } @@ -647,8 +658,8 @@ void ResGraphView::contentsMovingSlot(int x,int y) { - QRect z(int(x * _cvZoom), int(y * _cvZoom), - int(visibleWidth() * _cvZoom)-1, int(visibleHeight() * _cvZoom)-1); + QRect z(int(x * _cvZoomW), int(y * _cvZoomH), + int(visibleWidth() * _cvZoomW)-1, int(visibleHeight() * _cvZoomH)-1); if (0) qDebug("moving: (%d,%d) => (%d/%d - %dx%d)", x, y, z.x(), z.y(), z.width(), z.height()); m_CompleteView->setZoomRect(z); @@ -662,7 +673,7 @@ if (leftMargin()>0) dx = 0; if (topMargin()>0) dy = 0; _noUpdateZoomerPos = true; - scrollBy(int(dx/_cvZoom),int(dy/_cvZoom)); + scrollBy(int(dx/_cvZoomW),int(dy/_cvZoomH)); _noUpdateZoomerPos = false; } Modified: branches/tmp/schubi/solvertree/resgraphview.h URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/solvertree/resgraphview.h?rev=6005&r1=6004&r2=6005&view=diff ============================================================================== --- branches/tmp/schubi/solvertree/resgraphview.h (original) +++ branches/tmp/schubi/solvertree/resgraphview.h Fri Jul 13 15:13:14 2007 @@ -114,7 +114,8 @@ int _xMargin,_yMargin; GraphViewTipSolver*m_Tip; PannerView*m_CompleteView; - double _cvZoom; + double _cvZoomW; + double _cvZoomH; ZoomPosition m_LastAutoPosition; virtual void resizeEvent(QResizeEvent*); Modified: branches/tmp/schubi/solvertree/restreewidget.cpp URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/schubi/solvertree/restreewidget.cpp?rev=6005&r1=6004&r2=6005&view=diff ============================================================================== --- branches/tmp/schubi/solvertree/restreewidget.cpp (original) +++ branches/tmp/schubi/solvertree/restreewidget.cpp Fri Jul 13 15:13:14 2007 @@ -49,7 +49,7 @@ m_Detailstext->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, m_Detailstext->sizePolicy().hasHeightForWidth() ) ); m_Detailstext->setResizePolicy( QTextBrowser::Manual ); ResTreeWidgetLayout->addWidget( m_Splitter ); - resize( QSize(600, 480).expandedTo(minimumSizeHint()) ); +// resize( QSize(600, 480).expandedTo(minimumSizeHint()) ); clearWState( WState_Polished ); } -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org