Fix the new analysis dialog so it starts at a good size on os x
authorDiane Trout <diane@caltech.edu>
Wed, 18 Nov 2009 22:11:30 +0000 (14:11 -0800)
committerDiane Trout <diane@caltech.edu>
Wed, 18 Nov 2009 22:11:30 +0000 (14:11 -0800)
the previous default ended up with UI elements that were too squished.
this now allows the scroll area to resize the interior widget.

qui/mussa_setup_dialog/SequenceSetupFrame.cpp
qui/mussa_setup_dialog/SequenceSetupFrame.hpp
qui/mussa_setup_dialog/SequenceSetupWidget.cpp

index 4e1fb07f43dd0e5dc2d5de61368d0caff31a0978..0e12da4782216ccac868141390b8f0f39c234fa1 100644 (file)
@@ -24,7 +24,6 @@ SequenceSetupFrame::SequenceSetupFrame(QWidget *parent)
   sequenceLayout = new QVBoxLayout;  
 
   sequenceFrame->setLayout(sequenceLayout);
-  sequenceFrame->resize(500,500);
 
   //scroll area
   scrollArea = new QScrollArea;
@@ -35,9 +34,14 @@ SequenceSetupFrame::SequenceSetupFrame(QWidget *parent)
   setLayout(mainLayout);
 
   //Initialize to one sequence
-  changeSequenceCount(1);
+  changeSequenceCount(2);
   
+  //scrollArea->resize(sequenceFrame->sizeHint());
+  //sequenceFrame->resize(500,500);
+  //sequenceFrame->resize(scrollArea->size());
+  scrollArea->setWidgetResizable(TRUE);
   scrollArea->show();
+
 }
 
 QDir SequenceSetupFrame::get_default_dir() const 
@@ -54,19 +58,14 @@ void SequenceSetupFrame::changeSequenceCount(int newSeqCount)
 {
   seqCount = newSeqCount;
   setupSequences(seqCount);
-  resizeInnerFrame(seqCount);
+  resizeInnerFrame();
 }
 
-void SequenceSetupFrame::resizeInnerFrame(int seqCount)
+void SequenceSetupFrame::resizeInnerFrame()
 {
-  if (seqCount >= 1)
-  {
-    sequenceFrame->resize(565, 125 * seqCount + 30);
-  }
-  else
-  {
-    sequenceFrame->resize(565, 125 + 30);
-  }
+  QSize box(seqList.front()->sizeHint());
+
+  sequenceFrame->resize(box.width(), box.height() * seqList.size() + 30);
 }
 
 void SequenceSetupFrame::setupSequences(int newSeqCount)
index bfc07c0ca736c7dc6f4f050ee99d476e5df45f29..d9bd37e39b65310afbaca55d3dc162bdb56e62eb 100644 (file)
@@ -28,7 +28,7 @@ public slots:
 
 protected:
   void setupSequences(int seqCount);
-  void resizeInnerFrame(int seqCount);
+  void resizeInnerFrame();
   int seqCount;
 
   std::list<SequenceSetupWidget*> seqList;
index d1464dd17e0fdafac3f43dbba09bffe02f516429..464cc61b65e61302ad17e8f9eb94e99a270ce18b 100644 (file)
@@ -21,63 +21,63 @@ SequenceSetupWidget::SequenceSetupWidget(SequenceSetupFrame *setupFrame_,
   seqStopLineEdit(0),
   setupFrame(setupFrame_)
 {
-  // we really need the setupFrame, so lets declair that requirement
+  // we really need the setupFrame, so lets declare that requirement
   assert(setupFrame != 0);
 
   // Name line
-  sequenceNameEdit = new QLineEdit(this);
+  sequenceNameEdit = new QLineEdit();
   sequenceNameEdit->setWhatsThis(tr("Name of input sequence"));
-  QLabel *sequenceNameLabel = new QLabel(tr("Sequence name:"), this);
+  QLabel *sequenceNameLabel = new QLabel(tr("Sequence name:"));
   sequenceNameLabel->setBuddy(sequenceNameEdit);
   sequenceNameLabel->setWhatsThis(tr("Name of input sequence"));
 
   // Sequence file location line
-  sequenceLineEdit = new QLineEdit(this);
+  sequenceLineEdit = new QLineEdit();
   sequenceLineEdit->setWhatsThis(tr("File path to input sequence"));
   //const IsFileValidator *fileValidator = new IsFileValidator(this);
   //sequenceLineEdit->setValidator(fileValidator);
-  QLabel *sequenceLabel = new QLabel("Sequence Filename:", this);
+  QLabel *sequenceLabel = new QLabel("Sequence Filename:");
   sequenceLabel->setBuddy(sequenceLineEdit);
   sequenceLabel->setWhatsThis(tr("File path to input sequence"));
   
-  QPushButton *sequenceButton = new QPushButton(tr("Browse..."), this);
+  QPushButton *sequenceButton = new QPushButton(tr("Browse..."));
   sequenceButton->setWhatsThis(tr("Browse for input sequence"));
   connect(sequenceButton, SIGNAL(clicked()), 
          this, SLOT(promptForFastaFile()));
 
   // Annotation row
-  annotLineEdit = new QLineEdit(this);
+  annotLineEdit = new QLineEdit();
   annotLineEdit->setWhatsThis(tr("Annotation file path for above input sequence"));
   //const IsFileValidator *fileValidator2 = new IsFileValidator(this);
   //annotLineEdit->setValidator(fileValidator2);
-  QLabel *annotLabel = new QLabel(tr("Annotation Filename:"), this);
+  QLabel *annotLabel = new QLabel(tr("Annotation Filename:"));
   annotLabel->setBuddy(annotLineEdit);
   annotLabel->setWhatsThis(tr("Annotation file path for above input sequence"));
 
-  QPushButton *annotButton = new QPushButton(tr("Browse..."), this);
+  QPushButton *annotButton = new QPushButton(tr("Browse..."));
   annotButton->setWhatsThis(tr("Browse for annotation file for above input sequence"));
   connect(annotButton, SIGNAL(clicked()),
          this, SLOT(promptForAnnotFile()));
 
   // Index row
-  fastaIndexLineEdit = new QLineEdit(this);
+  fastaIndexLineEdit = new QLineEdit();
   fastaIndexLineEdit->setWhatsThis(tr("When a FASTA file contains more then one FASTA record, provide a 1 based index (first record is index 1) to select which one to use."));
   //fastaIndexLineEdit->setMaximumWidth(100);
 
-  QLabel *fastaIndexLabel = new QLabel(tr("Fasta Index:"), this);
+  QLabel *fastaIndexLabel = new QLabel(tr("Fasta Index:"));
   fastaIndexLabel->setBuddy(fastaIndexLineEdit);
   fastaIndexLabel->setWhatsThis(tr("When a FASTA file contains more then one FASTA record, provide a 1 based index (first record is index 1) to select which one to use."));
 
-  seqStartLineEdit = new QLineEdit(this);
+  seqStartLineEdit = new QLineEdit();
   seqStartLineEdit->setWhatsThis(tr("Start base pair in input sequence (0 based: 1st base pair is 0)"));
   //seqStartLineEdit->setMinimumWidth(60);
   //seqStartLineEdit->setMaximumWidth(80);
 
-  QLabel *seqStartLabel = new QLabel(tr("Sequence Start:"), this);
+  QLabel *seqStartLabel = new QLabel(tr("Sequence Start:"));
   seqStartLabel->setWhatsThis(tr("Start base pair in input sequence (0 based: 1st base pair is 0)"));
   seqStartLabel->setBuddy(seqStartLineEdit);
   
-  seqStopLineEdit = new QLineEdit(this);
+  seqStopLineEdit = new QLineEdit();
   seqStopLineEdit->setWhatsThis(tr("Stop base pair in input sequence (0 based: 1st base pair is 0) 0 means all of remaining sequence."));
   //seqStopLineEdit->setMinimumWidth(40);
   //seqStopLineEdit->setMaximumWidth(60);