mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-24 03:10:52 +01:00
Added API to get a valid TitleBlockTemplateLocation from a string.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1468 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -36,6 +36,15 @@ TitleBlockTemplateLocation::TitleBlockTemplateLocation(const QString &name, Titl
|
||||
TitleBlockTemplateLocation::~TitleBlockTemplateLocation() {
|
||||
}
|
||||
|
||||
/**
|
||||
@param loc_str String describing the location of a title block template.
|
||||
*/
|
||||
TitleBlockTemplateLocation TitleBlockTemplateLocation::locationFromString(const QString &loc_str) {
|
||||
TitleBlockTemplateLocation loc;
|
||||
loc.fromString(loc_str);
|
||||
return(loc);
|
||||
}
|
||||
|
||||
/**
|
||||
@return the parent collection of the template, or 0 if none was defined
|
||||
*/
|
||||
@@ -72,6 +81,20 @@ bool TitleBlockTemplateLocation::isValid() const {
|
||||
return(!name_.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
@param loc_str String describing the location of a title block template.
|
||||
*/
|
||||
void TitleBlockTemplateLocation::fromString(const QString &loc_str) {
|
||||
collection_ = QETApp::titleBlockTemplatesCollection(QUrl(loc_str).scheme());
|
||||
|
||||
QRegExp name_from_url("^[^:]*:\\/\\/(.*)$");
|
||||
if (name_from_url.exactMatch(loc_str)) {
|
||||
name_ = name_from_url.capturedTexts().at(1);
|
||||
} else {
|
||||
name_ = QString();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@return A string representation of the location
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user